diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2011-09-21 18:13:16 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-10-01 09:31:43 +0000 |
commit | 49b2c2545688614c7c146567e2200c935b338423 (patch) | |
tree | 5ab453462b2547211575129d051bd14ddc422396 /exec-all.h | |
parent | 0527fcaabef6b0c1d5e2d3deb97ae11e5d243646 (diff) | |
download | qemu-49b2c2545688614c7c146567e2200c935b338423.tar.gz qemu-49b2c2545688614c7c146567e2200c935b338423.tar.bz2 qemu-49b2c2545688614c7c146567e2200c935b338423.zip |
Move GETPC from dyngen-exec.h to exec-all.h
GETPC() can be used even from outside of helper code. Move the macro to
a more accessible location. Avoid a compile warning from redefining it in exec.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'exec-all.h')
-rw-r--r-- | exec-all.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/exec-all.h b/exec-all.h index b1dfe109d2..1120f84661 100644 --- a/exec-all.h +++ b/exec-all.h @@ -267,6 +267,18 @@ extern spinlock_t tb_lock; extern int tb_invalidated_flag; +/* The return address may point to the start of the next instruction. + Subtracting one gets us the call instruction itself. */ +#if defined(__s390__) && !defined(__s390x__) +# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1)) +#elif defined(__arm__) +/* Thumb return addresses have the low bit set, so we need to subtract two. + This is still safe in ARM mode because instructions are 4 bytes. */ +# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2)) +#else +# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1)) +#endif + #if !defined(CONFIG_USER_ONLY) extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; |