85 |
#define VIP_MASK 0x00100000 |
#define VIP_MASK 0x00100000 |
86 |
#define ID_MASK 0x00200000 |
#define ID_MASK 0x00200000 |
87 |
|
|
88 |
|
#define CR0_PE_MASK (1 << 0) |
89 |
|
#define CR0_TS_MASK (1 << 3) |
90 |
|
#define CR0_WP_MASK (1 << 16) |
91 |
|
#define CR0_AM_MASK (1 << 18) |
92 |
|
#define CR0_PG_MASK (1 << 31) |
93 |
|
|
94 |
|
#define CR4_VME_MASK (1 << 0) |
95 |
|
#define CR4_PVI_MASK (1 << 1) |
96 |
|
#define CR4_TSD_MASK (1 << 2) |
97 |
|
#define CR4_DE_MASK (1 << 3) |
98 |
|
|
99 |
#define EXCP00_DIVZ 0 |
#define EXCP00_DIVZ 0 |
100 |
#define EXCP01_SSTP 1 |
#define EXCP01_SSTP 1 |
101 |
#define EXCP02_NMI 2 |
#define EXCP02_NMI 2 |
172 |
#endif |
#endif |
173 |
|
|
174 |
typedef struct SegmentCache { |
typedef struct SegmentCache { |
175 |
|
uint32_t selector; |
176 |
uint8_t *base; |
uint8_t *base; |
177 |
unsigned long limit; |
unsigned long limit; |
178 |
uint8_t seg_32bit; |
uint8_t seg_32bit; |
179 |
} SegmentCache; |
} SegmentCache; |
180 |
|
|
|
typedef struct SegmentDescriptorTable { |
|
|
uint8_t *base; |
|
|
unsigned long limit; |
|
|
/* this is the returned base when reading the register, just to |
|
|
avoid that the emulated program modifies it */ |
|
|
unsigned long emu_base; |
|
|
} SegmentDescriptorTable; |
|
|
|
|
181 |
typedef struct CPUX86State { |
typedef struct CPUX86State { |
182 |
/* standard registers */ |
/* standard registers */ |
183 |
uint32_t regs[8]; |
uint32_t regs[8]; |
209 |
} fp_convert; |
} fp_convert; |
210 |
|
|
211 |
/* segments */ |
/* segments */ |
212 |
uint32_t segs[6]; /* selector values */ |
SegmentCache segs[6]; /* selector values */ |
213 |
SegmentCache seg_cache[6]; /* info taken from LDT/GDT */ |
SegmentCache ldt; |
214 |
SegmentDescriptorTable gdt; |
SegmentCache tr; |
215 |
SegmentDescriptorTable ldt; |
SegmentCache gdt; /* only base and limit are used */ |
216 |
SegmentDescriptorTable idt; |
SegmentCache idt; /* only base and limit are used */ |
217 |
|
|
218 |
/* exception/interrupt handling */ |
/* exception/interrupt handling */ |
219 |
jmp_buf jmp_env; |
jmp_buf jmp_env; |
220 |
int exception_index; |
int exception_index; |
221 |
int error_code; |
int error_code; |
222 |
uint32_t cr2; |
uint32_t cr[5]; /* NOTE: cr1 is unused */ |
223 |
|
uint32_t dr[8]; /* debug registers */ |
224 |
int interrupt_request; |
int interrupt_request; |
225 |
|
|
226 |
/* user data */ |
/* user data */ |