diff options
-rw-r--r-- | dyngen-exec.h | 12 | ||||
-rw-r--r-- | target-alpha/op_helper.c | 6 | ||||
-rw-r--r-- | target-arm/op_helper.c | 5 | ||||
-rw-r--r-- | target-cris/op_helper.c | 5 | ||||
-rw-r--r-- | target-i386/helper.c | 5 | ||||
-rw-r--r-- | target-m68k/op_helper.c | 5 | ||||
-rw-r--r-- | target-mips/op_helper.c | 6 | ||||
-rw-r--r-- | target-ppc/op_helper.c | 5 | ||||
-rw-r--r-- | target-sh4/op_helper.c | 5 | ||||
-rw-r--r-- | target-sparc/op_helper.c | 6 | ||||
-rw-r--r-- | tcg/arm/tcg-target.c | 1 |
11 files changed, 12 insertions, 49 deletions
diff --git a/dyngen-exec.h b/dyngen-exec.h index 52cb779..f51d363 100644 --- a/dyngen-exec.h +++ b/dyngen-exec.h @@ -287,4 +287,16 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3; #error unsupported CPU #endif +/* The return address may point to the start of the next instruction. + Subtracting one gets us the call instruction itself. */ +#if defined(__s390__) +# 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 + #endif /* !defined(__DYNGEN_EXEC_H__) */ diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c index 072499e..36b98b8 100644 --- a/target-alpha/op_helper.c +++ b/target-alpha/op_helper.c @@ -1093,12 +1093,6 @@ void helper_reset_FT2 (void) /* Softmmu support */ #if !defined (CONFIG_USER_ONLY) -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif - /* XXX: the two following helpers are pure hacks. * Hopefully, we emulate the PALcode, then we should never see * HW_LD / HW_ST instructions. diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index 555b55c..5d9fd84 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -68,11 +68,6 @@ uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, #if !defined(CONFIG_USER_ONLY) #define MMUSUFFIX _mmu -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c index ea8016b..abcf9b4 100644 --- a/target-cris/op_helper.c +++ b/target-cris/op_helper.c @@ -24,11 +24,6 @@ #include "mmu.h" #define MMUSUFFIX _mmu -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/target-i386/helper.c b/target-i386/helper.c index 4562a16..cab085a 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -4663,11 +4663,6 @@ static float approx_rcp(float a) #if !defined(CONFIG_USER_ONLY) #define MMUSUFFIX _mmu -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c index f45c4d9..f2e9f03 100644 --- a/target-m68k/op_helper.c +++ b/target-m68k/op_helper.c @@ -32,11 +32,6 @@ void do_interrupt(int is_hw) extern int semihosting_enabled; #define MMUSUFFIX _mmu -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index 017d12a..2020e9e 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -22,12 +22,6 @@ #include "host-utils.h" -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif - /*****************************************************************************/ /* Exceptions processing helpers */ diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 544d906..1c08172 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2612,11 +2612,6 @@ DO_SPE_OP1(fsctuf); #if !defined (CONFIG_USER_ONLY) #define MMUSUFFIX _mmu -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index bbc3030..8c8318f 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c @@ -28,11 +28,6 @@ void do_raise_exception(void) #ifndef CONFIG_USER_ONLY #define MMUSUFFIX _mmu -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 2d85560..250f719 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -2871,12 +2871,6 @@ static void do_unaligned_access(target_ulong addr, int is_write, int is_user, #define MMUSUFFIX _mmu #define ALIGNED_ONLY -#ifdef __s390__ -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & \ - 0x7fffffffUL)) -#else -# define GETPC() (__builtin_return_address(0)) -#endif #define SHIFT 0 #include "softmmu_template.h" diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index a3f4c6d..3ced47e 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -1180,7 +1180,6 @@ static inline void tcg_out_qemu_st(TCGContext *s, int cond, tcg_out_bl(s, cond, (tcg_target_long) qemu_st_helpers[s_bits] - (tcg_target_long) s->code_ptr); - # if TARGET_LONG_BITS == 64 if (opc == 3) tcg_out_dat_imm(s, cond, ARITH_ADD, 13, 13, 0x10); |