root / dyngen-exec.h @ 2c80e423
History | View | Annotate | Download (2.4 kB)
1 | 79638566 | bellard | /*
|
---|---|---|---|
2 | 79638566 | bellard | * dyngen defines for micro operation code
|
3 | 79638566 | bellard | *
|
4 | 79638566 | bellard | * Copyright (c) 2003 Fabrice Bellard
|
5 | 79638566 | bellard | *
|
6 | 79638566 | bellard | * This library is free software; you can redistribute it and/or
|
7 | 79638566 | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | 79638566 | bellard | * License as published by the Free Software Foundation; either
|
9 | 79638566 | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | 79638566 | bellard | *
|
11 | 79638566 | bellard | * This library is distributed in the hope that it will be useful,
|
12 | 79638566 | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 79638566 | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 79638566 | bellard | * Lesser General Public License for more details.
|
15 | 79638566 | bellard | *
|
16 | 79638566 | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | 8167ee88 | Blue Swirl | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
18 | 79638566 | bellard | */
|
19 | 67867308 | bellard | #if !defined(__DYNGEN_EXEC_H__)
|
20 | 67867308 | bellard | #define __DYNGEN_EXEC_H__
|
21 | 67867308 | bellard | |
22 | 47b01cf3 | Stefan Weil | #include "qemu-common.h" |
23 | 513b500f | bellard | |
24 | 128ab2ff | blueswir1 | #ifdef __OpenBSD__
|
25 | 128ab2ff | blueswir1 | #include <sys/types.h> |
26 | 128ab2ff | blueswir1 | #endif
|
27 | 79638566 | bellard | |
28 | 1057eaa7 | pbrook | /* XXX: This may be wrong for 64-bit ILP32 hosts. */
|
29 | c227f099 | Anthony Liguori | typedef void * host_reg_t; |
30 | 1057eaa7 | pbrook | |
31 | 522777bb | ths | #if defined(__i386__)
|
32 | 79638566 | bellard | #define AREG0 "ebp" |
33 | 522777bb | ths | #elif defined(__x86_64__)
|
34 | 43024c6a | ths | #define AREG0 "r14" |
35 | e58ffeb3 | malc | #elif defined(_ARCH_PPC)
|
36 | 79638566 | bellard | #define AREG0 "r27" |
37 | 522777bb | ths | #elif defined(__arm__)
|
38 | 79638566 | bellard | #define AREG0 "r7" |
39 | f54b3f92 | aurel32 | #elif defined(__hppa__)
|
40 | f54b3f92 | aurel32 | #define AREG0 "r17" |
41 | 522777bb | ths | #elif defined(__mips__)
|
42 | 60bf84cf | Stefan Weil | #define AREG0 "s0" |
43 | 522777bb | ths | #elif defined(__sparc__)
|
44 | dfe5fff3 | Juan Quintela | #ifdef CONFIG_SOLARIS
|
45 | fdbb4691 | bellard | #define AREG0 "g2" |
46 | fdbb4691 | bellard | #else
|
47 | 74ccb34e | bellard | #ifdef __sparc_v9__
|
48 | e97b640d | blueswir1 | #define AREG0 "g5" |
49 | 74ccb34e | bellard | #else
|
50 | 79638566 | bellard | #define AREG0 "g6" |
51 | fdbb4691 | bellard | #endif
|
52 | 74ccb34e | bellard | #endif
|
53 | 522777bb | ths | #elif defined(__s390__)
|
54 | 79638566 | bellard | #define AREG0 "r10" |
55 | 522777bb | ths | #elif defined(__alpha__)
|
56 | 79638566 | bellard | /* Note $15 is the frame pointer, so anything in op-i386.c that would
|
57 | 79638566 | bellard | require a frame pointer, like alloca, would probably loose. */
|
58 | 79638566 | bellard | #define AREG0 "$15" |
59 | 522777bb | ths | #elif defined(__mc68000)
|
60 | 38e584a0 | bellard | #define AREG0 "%a5" |
61 | 522777bb | ths | #elif defined(__ia64__)
|
62 | b8076a74 | bellard | #define AREG0 "r7" |
63 | 522777bb | ths | #else
|
64 | 522777bb | ths | #error unsupported CPU
|
65 | 79638566 | bellard | #endif
|
66 | 79638566 | bellard | |
67 | 79638566 | bellard | #define xglue(x, y) x ## y |
68 | 79638566 | bellard | #define glue(x, y) xglue(x, y)
|
69 | 9621339d | bellard | #define stringify(s) tostring(s)
|
70 | 9621339d | bellard | #define tostring(s) #s |
71 | 79638566 | bellard | |
72 | 9b7b85d2 | pbrook | /* The return address may point to the start of the next instruction.
|
73 | 9b7b85d2 | pbrook | Subtracting one gets us the call instruction itself. */
|
74 | 2827822e | Alexander Graf | #if defined(__s390__) && !defined(__s390x__)
|
75 | 9b7b85d2 | pbrook | # define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1)) |
76 | 9b7b85d2 | pbrook | #elif defined(__arm__)
|
77 | 9b7b85d2 | pbrook | /* Thumb return addresses have the low bit set, so we need to subtract two.
|
78 | 9b7b85d2 | pbrook | This is still safe in ARM mode because instructions are 4 bytes. */
|
79 | 9b7b85d2 | pbrook | # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2)) |
80 | 9b7b85d2 | pbrook | #else
|
81 | 9b7b85d2 | pbrook | # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1)) |
82 | 9b7b85d2 | pbrook | #endif
|
83 | 9b7b85d2 | pbrook | |
84 | 67867308 | bellard | #endif /* !defined(__DYNGEN_EXEC_H__) */ |