]> git.proxmox.com Git - qemu.git/blame - dyngen-exec.h
vnc: rename vnc-encoding-* vnc-enc-*
[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>
11165820 34#include <stdbool.h>
513b500f 35
128ab2ff
BS
36#ifdef __OpenBSD__
37#include <sys/types.h>
128ab2ff 38#endif
79638566 39
1057eaa7 40/* XXX: This may be wrong for 64-bit ILP32 hosts. */
c227f099 41typedef void * host_reg_t;
1057eaa7 42
71e72a19 43#ifdef CONFIG_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 *, ...);
79638566 51
522777bb 52#if defined(__i386__)
79638566 53#define AREG0 "ebp"
522777bb 54#elif defined(__x86_64__)
43024c6a 55#define AREG0 "r14"
e58ffeb3 56#elif defined(_ARCH_PPC)
79638566 57#define AREG0 "r27"
522777bb 58#elif defined(__arm__)
79638566 59#define AREG0 "r7"
f54b3f92
AJ
60#elif defined(__hppa__)
61#define AREG0 "r17"
522777bb 62#elif defined(__mips__)
60bf84cf 63#define AREG0 "s0"
522777bb 64#elif defined(__sparc__)
dfe5fff3 65#ifdef CONFIG_SOLARIS
fdbb4691 66#define AREG0 "g2"
fdbb4691 67#else
74ccb34e 68#ifdef __sparc_v9__
e97b640d 69#define AREG0 "g5"
74ccb34e 70#else
79638566 71#define AREG0 "g6"
fdbb4691 72#endif
74ccb34e 73#endif
522777bb 74#elif defined(__s390__)
79638566 75#define AREG0 "r10"
522777bb 76#elif defined(__alpha__)
79638566
FB
77/* Note $15 is the frame pointer, so anything in op-i386.c that would
78 require a frame pointer, like alloca, would probably loose. */
79#define AREG0 "$15"
522777bb 80#elif defined(__mc68000)
38e584a0 81#define AREG0 "%a5"
522777bb 82#elif defined(__ia64__)
b8076a74 83#define AREG0 "r7"
522777bb
TS
84#else
85#error unsupported CPU
79638566
FB
86#endif
87
79638566
FB
88#define xglue(x, y) x ## y
89#define glue(x, y) xglue(x, y)
9621339d
FB
90#define stringify(s) tostring(s)
91#define tostring(s) #s
79638566 92
9b7b85d2
PB
93/* The return address may point to the start of the next instruction.
94 Subtracting one gets us the call instruction itself. */
2827822e 95#if defined(__s390__) && !defined(__s390x__)
9b7b85d2
PB
96# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1))
97#elif defined(__arm__)
98/* Thumb return addresses have the low bit set, so we need to subtract two.
99 This is still safe in ARM mode because instructions are 4 bytes. */
100# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2))
101#else
102# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1))
103#endif
104
67867308 105#endif /* !defined(__DYNGEN_EXEC_H__) */