Statistics
| Branch: | Revision:

root / exec-i386.h @ 7d13299d

History | View | Annotate | Download (2.7 kB)

1
/* i386 execution defines */
2

    
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;
7

    
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;
12

    
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) )); \
21
})
22

    
23
#define NULL 0
24
#include <fenv.h>
25

    
26
typedef struct FILE FILE;
27
extern FILE *logfile;
28
extern int loglevel;
29
extern int fprintf(FILE *, const char *, ...);
30

    
31
#ifdef __i386__
32
register unsigned int T0 asm("ebx");
33
register unsigned int T1 asm("esi");
34
register unsigned int A0 asm("edi");
35
register struct CPUX86State *env asm("ebp");
36
#endif
37
#ifdef __powerpc__
38
register unsigned int T0 asm("r24");
39
register unsigned int T1 asm("r25");
40
register unsigned int A0 asm("r26");
41
register struct CPUX86State *env asm("r27");
42
#endif
43
#ifdef __arm__
44
register unsigned int T0 asm("r4");
45
register unsigned int T1 asm("r5");
46
register unsigned int A0 asm("r6");
47
register struct CPUX86State *env asm("r7");
48
#endif
49
#ifdef __mips__
50
register unsigned int T0 asm("s0");
51
register unsigned int T1 asm("s1");
52
register unsigned int A0 asm("s2");
53
register struct CPUX86State *env asm("s3");
54
#endif
55
#ifdef __sparc__
56
register unsigned int T0 asm("l0");
57
register unsigned int T1 asm("l1");
58
register unsigned int A0 asm("l2");
59
register struct CPUX86State *env asm("l3");
60
#endif
61

    
62
/* force GCC to generate only one epilog at the end of the function */
63
#define FORCE_RET() asm volatile ("");
64

    
65
#ifndef OPPROTO
66
#define OPPROTO
67
#endif
68

    
69
#define xglue(x, y) x ## y
70
#define glue(x, y) xglue(x, y)
71

    
72
#define EAX (env->regs[R_EAX])
73
#define ECX (env->regs[R_ECX])
74
#define EDX (env->regs[R_EDX])
75
#define EBX (env->regs[R_EBX])
76
#define ESP (env->regs[R_ESP])
77
#define EBP (env->regs[R_EBP])
78
#define ESI (env->regs[R_ESI])
79
#define EDI (env->regs[R_EDI])
80
#define PC  (env->pc)
81
#define DF  (env->df)
82

    
83
#define CC_SRC (env->cc_src)
84
#define CC_DST (env->cc_dst)
85
#define CC_OP  (env->cc_op)
86

    
87
/* float macros */
88
#define FT0    (env->ft0)
89
#define ST0    (env->fpregs[env->fpstt])
90
#define ST(n)  (env->fpregs[(env->fpstt + (n)) & 7])
91
#define ST1    ST(1)
92

    
93
extern int __op_param1, __op_param2, __op_param3;
94
#define PARAM1 ((long)(&__op_param1))
95
#define PARAM2 ((long)(&__op_param2))
96
#define PARAM3 ((long)(&__op_param3))
97

    
98
#include "cpu-i386.h"
99

    
100
typedef struct CCTable {
101
    int (*compute_all)(void); /* return all the flags */
102
    int (*compute_c)(void);  /* return the C flag */
103
} CCTable;
104

    
105
extern CCTable cc_table[];