]> git.proxmox.com Git - qemu.git/blame - dyngen-exec.h
Disable >4G ram support on 32-bit targets
[qemu.git] / dyngen-exec.h
CommitLineData
79638566
FB
1/*
2 * dyngen defines for micro operation code
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
fad6cb1a 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
79638566 19 */
67867308
FB
20#if !defined(__DYNGEN_EXEC_H__)
21#define __DYNGEN_EXEC_H__
22
ec530c81
FB
23/* prevent Solaris from trying to typedef FILE in gcc's
24 include/floatingpoint.h which will conflict with the
25 definition down below */
26#ifdef __sun__
27#define _FILEDEFED
28#endif
29
1e6cae95
FB
30/* NOTE: standard headers should be used with special care at this
31 point because host CPU registers are used as global variables. Some
32 host headers do not allow that. */
513b500f 33#include <stddef.h>
b7df4bcc 34#include <stdint.h>
513b500f 35
128ab2ff
BS
36#ifdef __OpenBSD__
37#include <sys/types.h>
128ab2ff 38#endif
79638566 39
1057eaa7
PB
40/* XXX: This may be wrong for 64-bit ILP32 hosts. */
41typedef void * host_reg_t;
42
179a2c19 43#ifdef HOST_BSD
cce1075c
TS
44typedef struct __sFILE FILE;
45#else
79638566 46typedef struct FILE FILE;
cce1075c 47#endif
79638566 48extern int fprintf(FILE *, const char *, ...);
24c7b0e3 49extern int fputs(const char *, FILE *);
79638566 50extern int printf(const char *, ...);
513b500f 51#undef NULL
79638566 52#define NULL 0
79638566 53
522777bb 54#if defined(__i386__)
79638566
FB
55#define AREG0 "ebp"
56#define AREG1 "ebx"
57#define AREG2 "esi"
522777bb 58#elif defined(__x86_64__)
43024c6a
TS
59#define AREG0 "r14"
60#define AREG1 "r15"
bc51c5c9 61#define AREG2 "r12"
e58ffeb3 62#elif defined(_ARCH_PPC)
79638566
FB
63#define AREG0 "r27"
64#define AREG1 "r24"
65#define AREG2 "r25"
522777bb 66#elif defined(__arm__)
79638566
FB
67#define AREG0 "r7"
68#define AREG1 "r4"
69#define AREG2 "r5"
f54b3f92
AJ
70#elif defined(__hppa__)
71#define AREG0 "r17"
72#define AREG1 "r14"
73#define AREG2 "r15"
522777bb 74#elif defined(__mips__)
c4b89d18 75#define AREG0 "fp"
79638566
FB
76#define AREG1 "s0"
77#define AREG2 "s1"
522777bb 78#elif defined(__sparc__)
fdbb4691
FB
79#ifdef HOST_SOLARIS
80#define AREG0 "g2"
81#define AREG1 "g3"
82#define AREG2 "g4"
fdbb4691 83#else
74ccb34e 84#ifdef __sparc_v9__
e97b640d
BS
85#define AREG0 "g5"
86#define AREG1 "g6"
87#define AREG2 "g7"
74ccb34e 88#else
79638566
FB
89#define AREG0 "g6"
90#define AREG1 "g1"
91#define AREG2 "g2"
fdbb4691 92#endif
74ccb34e 93#endif
522777bb 94#elif defined(__s390__)
79638566
FB
95#define AREG0 "r10"
96#define AREG1 "r7"
97#define AREG2 "r8"
522777bb 98#elif defined(__alpha__)
79638566
FB
99/* Note $15 is the frame pointer, so anything in op-i386.c that would
100 require a frame pointer, like alloca, would probably loose. */
101#define AREG0 "$15"
102#define AREG1 "$9"
103#define AREG2 "$10"
522777bb 104#elif defined(__mc68000)
38e584a0
FB
105#define AREG0 "%a5"
106#define AREG1 "%a4"
107#define AREG2 "%d7"
522777bb 108#elif defined(__ia64__)
b8076a74
FB
109#define AREG0 "r7"
110#define AREG1 "r4"
111#define AREG2 "r5"
522777bb
TS
112#else
113#error unsupported CPU
79638566
FB
114#endif
115
79638566
FB
116#define xglue(x, y) x ## y
117#define glue(x, y) xglue(x, y)
9621339d
FB
118#define stringify(s) tostring(s)
119#define tostring(s) #s
79638566 120
9b7b85d2
PB
121/* The return address may point to the start of the next instruction.
122 Subtracting one gets us the call instruction itself. */
123#if defined(__s390__)
124# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1))
125#elif defined(__arm__)
126/* Thumb return addresses have the low bit set, so we need to subtract two.
127 This is still safe in ARM mode because instructions are 4 bytes. */
128# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2))
129#else
130# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1))
131#endif
132
67867308 133#endif /* !defined(__DYNGEN_EXEC_H__) */