]>
git.proxmox.com Git - qemu.git/blob - cpu-i386.h
e528f61981a954a7919f51df8ca018ffdaf6dfa3
1 /* NOTE: this header is included in op-i386.c where global register
2 variable are used. Care must be used when including glibc headers.
41 #define TRAP_FLAG 0x0100
42 #define INTERRUPT_FLAG 0x0200
43 #define DIRECTION_FLAG 0x0400
44 #define IOPL_FLAG_MASK 0x3000
45 #define NESTED_FLAG 0x4000
46 #define BYTE_FL 0x8000 /* Intel reserved! */
47 #define RF_FLAG 0x10000
48 #define VM_FLAG 0x20000
56 #define EXCP05_BOUND 6
57 #define EXCP06_ILLOP 7
60 #define EXCP09_XERR 10
62 #define EXCP0B_NOSEG 12
63 #define EXCP0C_STACK 13
65 #define EXCP0E_PAGE 15
66 #define EXCP10_COPR 17
67 #define EXCP11_ALGN 18
68 #define EXCP12_MCHK 19
70 #define EXCP_SIGNAL 256 /* async signal */
73 CC_OP_DYNAMIC
, /* must use dynamic code to get cc_op */
74 CC_OP_EFLAGS
, /* all cc are explicitely computed, CC_SRC = flags */
75 CC_OP_MUL
, /* modify all flags, C, O = (CC_SRC != 0) */
77 CC_OP_ADDB
, /* modify all flags, CC_DST = res, CC_SRC = src1 */
81 CC_OP_ADCB
, /* modify all flags, CC_DST = res, CC_SRC = src1 */
85 CC_OP_SUBB
, /* modify all flags, CC_DST = res, CC_SRC = src1 */
89 CC_OP_SBBB
, /* modify all flags, CC_DST = res, CC_SRC = src1 */
93 CC_OP_LOGICB
, /* modify all flags, CC_DST = res */
97 CC_OP_INCB
, /* modify all flags except, CC_DST = res, CC_SRC = C */
101 CC_OP_DECB
, /* modify all flags except, CC_DST = res, CC_SRC = C */
105 CC_OP_SHLB
, /* modify all flags, CC_DST = res, CC_SRC.lsb = C */
109 CC_OP_SARB
, /* modify all flags, CC_DST = res, CC_SRC.lsb = C */
117 #define USE_X86LDOUBLE
120 #ifdef USE_X86LDOUBLE
121 typedef long double CPU86_LDouble
;
123 typedef double CPU86_LDouble
;
126 typedef struct CPUX86State
{
127 /* standard registers */
129 uint32_t pc
; /* cs_case + eip value */
132 /* emulator internal eflags handling */
136 int32_t df
; /* D flag : 1 if D = 0, -1 if D = 1 */
139 uint8_t *segs_base
[6];
142 unsigned int fpstt
; /* top of stack index */
145 uint8_t fptags
[8]; /* 0 = valid, 1 = empty */
146 CPU86_LDouble fpregs
[8];
151 /* emulator internal variables */
155 /* exception handling */
160 static inline int ldub(void *ptr
)
162 return *(uint8_t *)ptr
;
165 static inline int ldsb(void *ptr
)
167 return *(int8_t *)ptr
;
170 static inline int lduw(void *ptr
)
172 return *(uint16_t *)ptr
;
175 static inline int ldsw(void *ptr
)
177 return *(int16_t *)ptr
;
180 static inline int ldl(void *ptr
)
182 return *(uint32_t *)ptr
;
185 static inline uint64_t ldq(void *ptr
)
187 return *(uint64_t *)ptr
;
190 static inline void stb(void *ptr
, int v
)
195 static inline void stw(void *ptr
, int v
)
197 *(uint16_t *)ptr
= v
;
200 static inline void stl(void *ptr
, int v
)
202 *(uint32_t *)ptr
= v
;
205 static inline void stq(void *ptr
, int v
)
207 *(uint64_t *)ptr
= v
;
212 static inline float ldfl(void *ptr
)
214 return *(float *)ptr
;
217 static inline double ldfq(void *ptr
)
219 return *(double *)ptr
;
222 static inline void stfl(void *ptr
, float v
)
227 static inline void stfq(void *ptr
, double v
)
233 void cpu_x86_outb(int addr
, int val
);
234 void cpu_x86_outw(int addr
, int val
);
235 void cpu_x86_outl(int addr
, int val
);
236 int cpu_x86_inb(int addr
);
237 int cpu_x86_inw(int addr
);
238 int cpu_x86_inl(int addr
);
241 CPUX86State
*cpu_x86_init(void);
242 int cpu_x86_exec(CPUX86State
*s
);
243 void cpu_x86_close(CPUX86State
*s
);
245 /* internal functions */
246 int cpu_x86_gen_code(uint8_t *gen_code_buf
, int *gen_code_size_ptr
,
249 #endif /* CPU_I386_H */