Revision 927f621e cpu-i386.h
b/cpu-i386.h | ||
---|---|---|
75 | 75 |
CC_OP_NB, |
76 | 76 |
}; |
77 | 77 |
|
78 |
#ifdef __i386__ |
|
79 |
#define USE_X86LDOUBLE |
|
80 |
#endif |
|
81 |
|
|
82 |
#ifdef USE_X86LDOUBLE |
|
83 |
typedef long double CPU86_LDouble; |
|
84 |
#else |
|
85 |
typedef double CPU86_LDouble; |
|
86 |
#endif |
|
87 |
|
|
78 | 88 |
typedef struct CPU86State { |
79 | 89 |
/* standard registers */ |
80 | 90 |
uint32_t regs[8]; |
... | ... | |
91 | 101 |
uint8_t *segs_base[6]; |
92 | 102 |
uint32_t segs[6]; |
93 | 103 |
|
104 |
/* FPU state */ |
|
105 |
CPU86_LDouble fpregs[8]; |
|
106 |
uint8_t fptags[8]; /* 0 = valid, 1 = empty */ |
|
107 |
unsigned int fpstt; /* top of stack index */ |
|
108 |
unsigned int fpus; |
|
109 |
unsigned int fpuc; |
|
110 |
|
|
94 | 111 |
/* emulator internal variables */ |
95 | 112 |
uint32_t t0; /* temporary t0 storage */ |
96 | 113 |
uint32_t t1; /* temporary t1 storage */ |
97 | 114 |
uint32_t a0; /* temporary a0 storage (address) */ |
115 |
CPU86_LDouble ft0; |
|
98 | 116 |
} CPU86State; |
99 | 117 |
|
100 | 118 |
static inline int ldub(void *ptr) |
... | ... | |
122 | 140 |
return *(uint32_t *)ptr; |
123 | 141 |
} |
124 | 142 |
|
143 |
static inline uint64_t ldq(void *ptr) |
|
144 |
{ |
|
145 |
return *(uint64_t *)ptr; |
|
146 |
} |
|
125 | 147 |
|
126 | 148 |
static inline void stb(void *ptr, int v) |
127 | 149 |
{ |
... | ... | |
138 | 160 |
*(uint32_t *)ptr = v; |
139 | 161 |
} |
140 | 162 |
|
163 |
static inline void stq(void *ptr, int v) |
|
164 |
{ |
|
165 |
*(uint64_t *)ptr = v; |
|
166 |
} |
|
167 |
|
|
168 |
/* float access */ |
|
169 |
|
|
170 |
static inline float ldfl(void *ptr) |
|
171 |
{ |
|
172 |
return *(float *)ptr; |
|
173 |
} |
|
174 |
|
|
175 |
static inline double ldfq(void *ptr) |
|
176 |
{ |
|
177 |
return *(double *)ptr; |
|
178 |
} |
|
179 |
|
|
180 |
static inline void stfl(void *ptr, float v) |
|
181 |
{ |
|
182 |
*(float *)ptr = v; |
|
183 |
} |
|
184 |
|
|
185 |
static inline void stfq(void *ptr, double v) |
|
186 |
{ |
|
187 |
*(double *)ptr = v; |
|
188 |
} |
|
189 |
|
|
190 |
#ifndef IN_OP_I386 |
|
141 | 191 |
void port_outb(int addr, int val); |
142 | 192 |
void port_outw(int addr, int val); |
143 | 193 |
void port_outl(int addr, int val); |
144 | 194 |
int port_inb(int addr); |
145 | 195 |
int port_inw(int addr); |
146 | 196 |
int port_inl(int addr); |
197 |
#endif |
|
147 | 198 |
|
148 | 199 |
#endif /* CPU_I386_H */ |
Also available in: Unified diff