]>
Commit | Line | Data |
---|---|---|
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 | ||
522777bb | 22 | #if defined(__i386__) |
79638566 | 23 | #define AREG0 "ebp" |
522777bb | 24 | #elif defined(__x86_64__) |
43024c6a | 25 | #define AREG0 "r14" |
e58ffeb3 | 26 | #elif defined(_ARCH_PPC) |
79638566 | 27 | #define AREG0 "r27" |
522777bb | 28 | #elif defined(__arm__) |
79638566 | 29 | #define AREG0 "r7" |
f54b3f92 AJ |
30 | #elif defined(__hppa__) |
31 | #define AREG0 "r17" | |
522777bb | 32 | #elif defined(__mips__) |
60bf84cf | 33 | #define AREG0 "s0" |
522777bb | 34 | #elif defined(__sparc__) |
dfe5fff3 | 35 | #ifdef CONFIG_SOLARIS |
fdbb4691 | 36 | #define AREG0 "g2" |
fdbb4691 | 37 | #else |
74ccb34e | 38 | #ifdef __sparc_v9__ |
e97b640d | 39 | #define AREG0 "g5" |
74ccb34e | 40 | #else |
79638566 | 41 | #define AREG0 "g6" |
fdbb4691 | 42 | #endif |
74ccb34e | 43 | #endif |
522777bb | 44 | #elif defined(__s390__) |
79638566 | 45 | #define AREG0 "r10" |
522777bb | 46 | #elif defined(__alpha__) |
79638566 FB |
47 | /* Note $15 is the frame pointer, so anything in op-i386.c that would |
48 | require a frame pointer, like alloca, would probably loose. */ | |
49 | #define AREG0 "$15" | |
522777bb | 50 | #elif defined(__mc68000) |
38e584a0 | 51 | #define AREG0 "%a5" |
522777bb | 52 | #elif defined(__ia64__) |
b8076a74 | 53 | #define AREG0 "r7" |
522777bb TS |
54 | #else |
55 | #error unsupported CPU | |
79638566 FB |
56 | #endif |
57 | ||
3e457172 BS |
58 | register CPUState *env asm(AREG0); |
59 | ||
9b7b85d2 PB |
60 | /* The return address may point to the start of the next instruction. |
61 | Subtracting one gets us the call instruction itself. */ | |
2827822e | 62 | #if defined(__s390__) && !defined(__s390x__) |
9b7b85d2 PB |
63 | # define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1)) |
64 | #elif defined(__arm__) | |
65 | /* Thumb return addresses have the low bit set, so we need to subtract two. | |
66 | This is still safe in ARM mode because instructions are 4 bytes. */ | |
67 | # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2)) | |
68 | #else | |
69 | # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1)) | |
70 | #endif | |
71 | ||
67867308 | 72 | #endif /* !defined(__DYNGEN_EXEC_H__) */ |