]> git.proxmox.com Git - qemu.git/blame - exec-i386.h
distribution patches
[qemu.git] / exec-i386.h
CommitLineData
3ef693a0
FB
1/*
2 * i386 execution defines
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
7d13299d
FB
20typedef unsigned char uint8_t;
21typedef unsigned short uint16_t;
22typedef unsigned int uint32_t;
23typedef unsigned long long uint64_t;
24
25typedef signed char int8_t;
26typedef signed short int16_t;
27typedef signed int int32_t;
28typedef signed long long int64_t;
29
30#define bswap32(x) \
31({ \
32 uint32_t __x = (x); \
33 ((uint32_t)( \
34 (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
35 (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
36 (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
37 (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
38})
39
40#define NULL 0
41#include <fenv.h>
42
43typedef struct FILE FILE;
44extern FILE *logfile;
45extern int loglevel;
46extern int fprintf(FILE *, const char *, ...);
6dbad63e 47extern int printf(const char *, ...);
7d13299d
FB
48
49#ifdef __i386__
50register unsigned int T0 asm("ebx");
51register unsigned int T1 asm("esi");
52register unsigned int A0 asm("edi");
53register struct CPUX86State *env asm("ebp");
54#endif
55#ifdef __powerpc__
04369ff2
FB
56register unsigned int EAX asm("r16");
57register unsigned int ECX asm("r17");
58register unsigned int EDX asm("r18");
59register unsigned int EBX asm("r19");
60register unsigned int ESP asm("r20");
61register unsigned int EBP asm("r21");
62register unsigned int ESI asm("r22");
63register unsigned int EDI asm("r23");
7d13299d
FB
64register unsigned int T0 asm("r24");
65register unsigned int T1 asm("r25");
66register unsigned int A0 asm("r26");
67register struct CPUX86State *env asm("r27");
04369ff2
FB
68#define USE_INT_TO_FLOAT_HELPERS
69#define reg_EAX
70#define reg_ECX
71#define reg_EDX
72#define reg_EBX
73#define reg_ESP
74#define reg_EBP
75#define reg_ESI
76#define reg_EDI
7d13299d
FB
77#endif
78#ifdef __arm__
79register unsigned int T0 asm("r4");
80register unsigned int T1 asm("r5");
81register unsigned int A0 asm("r6");
82register struct CPUX86State *env asm("r7");
83#endif
84#ifdef __mips__
85register unsigned int T0 asm("s0");
86register unsigned int T1 asm("s1");
87register unsigned int A0 asm("s2");
88register struct CPUX86State *env asm("s3");
89#endif
90#ifdef __sparc__
91register unsigned int T0 asm("l0");
92register unsigned int T1 asm("l1");
93register unsigned int A0 asm("l2");
94register struct CPUX86State *env asm("l3");
95#endif
96
97/* force GCC to generate only one epilog at the end of the function */
98#define FORCE_RET() asm volatile ("");
99
100#ifndef OPPROTO
101#define OPPROTO
102#endif
103
104#define xglue(x, y) x ## y
105#define glue(x, y) xglue(x, y)
106
04369ff2 107#ifndef reg_EAX
7d13299d 108#define EAX (env->regs[R_EAX])
04369ff2
FB
109#endif
110#ifndef reg_ECX
7d13299d 111#define ECX (env->regs[R_ECX])
04369ff2
FB
112#endif
113#ifndef reg_EDX
7d13299d 114#define EDX (env->regs[R_EDX])
04369ff2
FB
115#endif
116#ifndef reg_EBX
7d13299d 117#define EBX (env->regs[R_EBX])
04369ff2
FB
118#endif
119#ifndef reg_ESP
7d13299d 120#define ESP (env->regs[R_ESP])
04369ff2
FB
121#endif
122#ifndef reg_EBP
7d13299d 123#define EBP (env->regs[R_EBP])
04369ff2
FB
124#endif
125#ifndef reg_ESI
7d13299d 126#define ESI (env->regs[R_ESI])
04369ff2
FB
127#endif
128#ifndef reg_EDI
7d13299d 129#define EDI (env->regs[R_EDI])
04369ff2 130#endif
dab2ed99 131#define EIP (env->eip)
7d13299d
FB
132#define DF (env->df)
133
134#define CC_SRC (env->cc_src)
135#define CC_DST (env->cc_dst)
136#define CC_OP (env->cc_op)
137
138/* float macros */
139#define FT0 (env->ft0)
140#define ST0 (env->fpregs[env->fpstt])
141#define ST(n) (env->fpregs[(env->fpstt + (n)) & 7])
142#define ST1 ST(1)
143
144extern int __op_param1, __op_param2, __op_param3;
145#define PARAM1 ((long)(&__op_param1))
146#define PARAM2 ((long)(&__op_param2))
147#define PARAM3 ((long)(&__op_param3))
148
149#include "cpu-i386.h"
150
151typedef struct CCTable {
152 int (*compute_all)(void); /* return all the flags */
153 int (*compute_c)(void); /* return the C flag */
154} CCTable;
155
156extern CCTable cc_table[];
6dbad63e
FB
157
158void load_seg(int seg_reg, int selector);
1b6b029e
FB
159void cpu_lock(void);
160void cpu_unlock(void);
9de5e440
FB
161void raise_exception(int exception_index);
162
163void OPPROTO op_movl_eflags_T0(void);
164void OPPROTO op_movl_T0_eflags(void);