Add missing test for 'singlestep'
[qemu/hppa.git] / dyngen-exec.h
blobc9841df151fe1962ba6c99baac7612e8cbfcc77a
1 /*
2 * dyngen defines for micro operation code
4 * Copyright (c) 2003 Fabrice Bellard
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
20 #if !defined(__DYNGEN_EXEC_H__)
21 #define __DYNGEN_EXEC_H__
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
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. */
33 #include <stddef.h>
34 #include <stdint.h>
36 #ifdef __OpenBSD__
37 #include <sys/types.h>
38 #endif
40 /* XXX: This may be wrong for 64-bit ILP32 hosts. */
41 typedef void * host_reg_t;
43 #ifdef HOST_BSD
44 typedef struct __sFILE FILE;
45 #else
46 typedef struct FILE FILE;
47 #endif
48 extern int fprintf(FILE *, const char *, ...);
49 extern int fputs(const char *, FILE *);
50 extern int printf(const char *, ...);
51 #undef NULL
52 #define NULL 0
54 #if defined(__i386__)
55 #define AREG0 "ebp"
56 #define AREG1 "ebx"
57 #define AREG2 "esi"
58 #elif defined(__x86_64__)
59 #define AREG0 "r14"
60 #define AREG1 "r15"
61 #define AREG2 "r12"
62 #elif defined(_ARCH_PPC)
63 #define AREG0 "r27"
64 #define AREG1 "r24"
65 #define AREG2 "r25"
66 #elif defined(__arm__)
67 #define AREG0 "r7"
68 #define AREG1 "r4"
69 #define AREG2 "r5"
70 #elif defined(__hppa__)
71 #define AREG0 "r17"
72 #define AREG1 "r14"
73 #define AREG2 "r15"
74 #elif defined(__mips__)
75 #define AREG0 "fp"
76 #define AREG1 "s0"
77 #define AREG2 "s1"
78 #elif defined(__sparc__)
79 #ifdef HOST_SOLARIS
80 #define AREG0 "g2"
81 #define AREG1 "g3"
82 #define AREG2 "g4"
83 #else
84 #ifdef __sparc_v9__
85 #define AREG0 "g5"
86 #define AREG1 "g6"
87 #define AREG2 "g7"
88 #else
89 #define AREG0 "g6"
90 #define AREG1 "g1"
91 #define AREG2 "g2"
92 #endif
93 #endif
94 #elif defined(__s390__)
95 #define AREG0 "r10"
96 #define AREG1 "r7"
97 #define AREG2 "r8"
98 #elif defined(__alpha__)
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"
104 #elif defined(__mc68000)
105 #define AREG0 "%a5"
106 #define AREG1 "%a4"
107 #define AREG2 "%d7"
108 #elif defined(__ia64__)
109 #define AREG0 "r7"
110 #define AREG1 "r4"
111 #define AREG2 "r5"
112 #else
113 #error unsupported CPU
114 #endif
116 #define xglue(x, y) x ## y
117 #define glue(x, y) xglue(x, y)
118 #define stringify(s) tostring(s)
119 #define tostring(s) #s
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
133 #endif /* !defined(__DYNGEN_EXEC_H__) */