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