libhd
5.0
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
x86emu
include
x86emu
fpu_regs.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* Realmode X86 Emulator Library
4
*
5
* Copyright (C) 1996-1999 SciTech Software, Inc.
6
* Copyright (C) David Mosberger-Tang
7
* Copyright (C) 1999 Egbert Eich
8
*
9
* ========================================================================
10
*
11
* Permission to use, copy, modify, distribute, and sell this software and
12
* its documentation for any purpose is hereby granted without fee,
13
* provided that the above copyright notice appear in all copies and that
14
* both that copyright notice and this permission notice appear in
15
* supporting documentation, and that the name of the authors not be used
16
* in advertising or publicity pertaining to distribution of the software
17
* without specific, written prior permission. The authors makes no
18
* representations about the suitability of this software for any purpose.
19
* It is provided "as is" without express or implied warranty.
20
*
21
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
22
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
23
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
24
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
25
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
* PERFORMANCE OF THIS SOFTWARE.
28
*
29
* ========================================================================
30
*
31
* Language: ANSI C
32
* Environment: Any
33
* Developer: Kendall Bennett
34
*
35
* Description: Header file for FPU register definitions.
36
*
37
****************************************************************************/
38
/* $XFree86: xc/extras/x86emu/include/x86emu/fpu_regs.h,v 1.2 2003/10/22 20:03:05 tsi Exp $ */
39
40
#ifndef __X86EMU_FPU_REGS_H
41
#define __X86EMU_FPU_REGS_H
42
43
#ifdef X86_FPU_SUPPORT
44
45
#ifdef PACK
46
# pragma PACK
47
#endif
48
49
/* Basic 8087 register can hold any of the following values: */
50
51
union
x86_fpu_reg_u {
52
s8
tenbytes[10];
53
double
dval;
54
float
fval;
55
s16
sval;
56
s32
lval;
57
};
58
59
struct
x86_fpu_reg {
60
union
x86_fpu_reg_u reg;
61
char
tag;
62
};
63
64
/*
65
* Since we are not going to worry about the problems of aliasing
66
* registers, every time a register is modified, its result type is
67
* set in the tag fields for that register. If some operation
68
* attempts to access the type in a way inconsistent with its current
69
* storage format, then we flag the operation. If common, we'll
70
* attempt the conversion.
71
*/
72
73
#define X86_FPU_VALID 0x80
74
#define X86_FPU_REGTYP(r) ((r) & 0x7F)
75
76
#define X86_FPU_WORD 0x0
77
#define X86_FPU_SHORT 0x1
78
#define X86_FPU_LONG 0x2
79
#define X86_FPU_FLOAT 0x3
80
#define X86_FPU_DOUBLE 0x4
81
#define X86_FPU_LDBL 0x5
82
#define X86_FPU_BSD 0x6
83
84
#define X86_FPU_STKTOP 0
85
86
struct
x86_fpu_registers {
87
struct
x86_fpu_reg x86_fpu_stack[8];
88
int
x86_fpu_flags;
89
int
x86_fpu_config;
/* rounding modes, etc. */
90
short
x86_fpu_tos, x86_fpu_bos;
91
};
92
93
#ifdef END_PACK
94
# pragma END_PACK
95
#endif
96
97
/*
98
* There are two versions of the following macro.
99
*
100
* One version is for opcode D9, for which there are more than 32
101
* instructions encoded in the second byte of the opcode.
102
*
103
* The other version, deals with all the other 7 i87 opcodes, for
104
* which there are only 32 strings needed to describe the
105
* instructions.
106
*/
107
108
#endif
/* X86_FPU_SUPPORT */
109
110
#ifdef DEBUG
111
# define DECODE_PRINTINSTR32(t,mod,rh,rl) \
112
DECODE_PRINTF(t[(mod<<3)+(rh)]);
113
# define DECODE_PRINTINSTR256(t,mod,rh,rl) \
114
DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]);
115
#else
116
# define DECODE_PRINTINSTR32(t,mod,rh,rl)
117
# define DECODE_PRINTINSTR256(t,mod,rh,rl)
118
#endif
119
120
#endif
/* __X86EMU_FPU_REGS_H */