added code16 tests
[qemu/ar7.git] / exec-i386.h
blob0384d0bf22c5a16760282c08b58dd67c6decc700
1 /* i386 execution defines */
3 typedef unsigned char uint8_t;
4 typedef unsigned short uint16_t;
5 typedef unsigned int uint32_t;
6 typedef unsigned long long uint64_t;
8 typedef signed char int8_t;
9 typedef signed short int16_t;
10 typedef signed int int32_t;
11 typedef signed long long int64_t;
13 #define bswap32(x) \
14 ({ \
15 uint32_t __x = (x); \
16 ((uint32_t)( \
17 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
18 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
19 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
20 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
23 #define NULL 0
24 #include <fenv.h>
26 typedef struct FILE FILE;
27 extern FILE *logfile;
28 extern int loglevel;
29 extern int fprintf(FILE *, const char *, ...);
30 extern int printf(const char *, ...);
32 #ifdef __i386__
33 register unsigned int T0 asm("ebx");
34 register unsigned int T1 asm("esi");
35 register unsigned int A0 asm("edi");
36 register struct CPUX86State *env asm("ebp");
37 #endif
38 #ifdef __powerpc__
39 register unsigned int EAX asm("r16");
40 register unsigned int ECX asm("r17");
41 register unsigned int EDX asm("r18");
42 register unsigned int EBX asm("r19");
43 register unsigned int ESP asm("r20");
44 register unsigned int EBP asm("r21");
45 register unsigned int ESI asm("r22");
46 register unsigned int EDI asm("r23");
47 register unsigned int T0 asm("r24");
48 register unsigned int T1 asm("r25");
49 register unsigned int A0 asm("r26");
50 register struct CPUX86State *env asm("r27");
51 #define USE_INT_TO_FLOAT_HELPERS
52 #define reg_EAX
53 #define reg_ECX
54 #define reg_EDX
55 #define reg_EBX
56 #define reg_ESP
57 #define reg_EBP
58 #define reg_ESI
59 #define reg_EDI
60 #endif
61 #ifdef __arm__
62 register unsigned int T0 asm("r4");
63 register unsigned int T1 asm("r5");
64 register unsigned int A0 asm("r6");
65 register struct CPUX86State *env asm("r7");
66 #endif
67 #ifdef __mips__
68 register unsigned int T0 asm("s0");
69 register unsigned int T1 asm("s1");
70 register unsigned int A0 asm("s2");
71 register struct CPUX86State *env asm("s3");
72 #endif
73 #ifdef __sparc__
74 register unsigned int T0 asm("l0");
75 register unsigned int T1 asm("l1");
76 register unsigned int A0 asm("l2");
77 register struct CPUX86State *env asm("l3");
78 #endif
80 /* force GCC to generate only one epilog at the end of the function */
81 #define FORCE_RET() asm volatile ("");
83 #ifndef OPPROTO
84 #define OPPROTO
85 #endif
87 #define xglue(x, y) x ## y
88 #define glue(x, y) xglue(x, y)
90 #ifndef reg_EAX
91 #define EAX (env->regs[R_EAX])
92 #endif
93 #ifndef reg_ECX
94 #define ECX (env->regs[R_ECX])
95 #endif
96 #ifndef reg_EDX
97 #define EDX (env->regs[R_EDX])
98 #endif
99 #ifndef reg_EBX
100 #define EBX (env->regs[R_EBX])
101 #endif
102 #ifndef reg_ESP
103 #define ESP (env->regs[R_ESP])
104 #endif
105 #ifndef reg_EBP
106 #define EBP (env->regs[R_EBP])
107 #endif
108 #ifndef reg_ESI
109 #define ESI (env->regs[R_ESI])
110 #endif
111 #ifndef reg_EDI
112 #define EDI (env->regs[R_EDI])
113 #endif
114 #define PC (env->pc)
115 #define DF (env->df)
117 #define CC_SRC (env->cc_src)
118 #define CC_DST (env->cc_dst)
119 #define CC_OP (env->cc_op)
121 /* float macros */
122 #define FT0 (env->ft0)
123 #define ST0 (env->fpregs[env->fpstt])
124 #define ST(n) (env->fpregs[(env->fpstt + (n)) & 7])
125 #define ST1 ST(1)
127 extern int __op_param1, __op_param2, __op_param3;
128 #define PARAM1 ((long)(&__op_param1))
129 #define PARAM2 ((long)(&__op_param2))
130 #define PARAM3 ((long)(&__op_param3))
132 #include "cpu-i386.h"
134 typedef struct CCTable {
135 int (*compute_all)(void); /* return all the flags */
136 int (*compute_c)(void); /* return the C flag */
137 } CCTable;
139 extern CCTable cc_table[];
141 void load_seg(int seg_reg, int selector);