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, see <http://www.gnu.org/licenses/>.
19 #if !defined(__DYNGEN_EXEC_H__)
20 #define __DYNGEN_EXEC_H__
24 #elif defined(__x86_64__)
26 #elif defined(_ARCH_PPC)
28 #elif defined(__arm__)
30 #elif defined(__hppa__)
32 #elif defined(__mips__)
34 #elif defined(__sparc__)
44 #elif defined(__s390__)
46 #elif defined(__alpha__)
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. */
50 #elif defined(__mc68000)
52 #elif defined(__ia64__)
55 #error unsupported CPU
58 register CPUState
*env
asm(AREG0
);
60 /* The return address may point to the start of the next instruction.
61 Subtracting one gets us the call instruction itself. */
62 #if defined(__s390__) && !defined(__s390x__)
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))
69 # define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1))
72 #endif /* !defined(__DYNGEN_EXEC_H__) */