summaryrefslogtreecommitdiff
path: root/qemu
diff options
context:
space:
mode:
authorpbrook <pbrook>2008-05-25 00:36:06 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-25 00:36:06 +0000
commit928096abc3e327ff6c3a52e3f0af3dd90f50acfa (patch)
tree685bd291e23bb372818b6c194a6f90b3be61e16a /qemu
parentda14ed655bf1c73e29e3c8bfa801766f8dd51531 (diff)
Fix off-by-one unwinding error.
Diffstat (limited to 'qemu')
-rw-r--r--qemu/dyngen-exec.h12
-rw-r--r--qemu/target-alpha/op_helper.c6
-rw-r--r--qemu/target-arm/op_helper.c5
-rw-r--r--qemu/target-cris/op_helper.c5
-rw-r--r--qemu/target-i386/helper.c5
-rw-r--r--qemu/target-m68k/op_helper.c5
-rw-r--r--qemu/target-mips/op_helper.c6
-rw-r--r--qemu/target-ppc/op_helper.c5
-rw-r--r--qemu/target-sh4/op_helper.c5
-rw-r--r--qemu/target-sparc/op_helper.c6
-rw-r--r--qemu/tcg/arm/tcg-target.c1
11 files changed, 12 insertions, 49 deletions
diff --git a/qemu/dyngen-exec.h b/qemu/dyngen-exec.h
index 52cb779d..f51d3632 100644
--- a/qemu/dyngen-exec.h
+++ b/qemu/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/qemu/target-alpha/op_helper.c b/qemu/target-alpha/op_helper.c
index 072499e3..36b98b88 100644
--- a/qemu/target-alpha/op_helper.c
+++ b/qemu/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/qemu/target-arm/op_helper.c b/qemu/target-arm/op_helper.c
index 555b55c6..5d9fd848 100644
--- a/qemu/target-arm/op_helper.c
+++ b/qemu/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/qemu/target-cris/op_helper.c b/qemu/target-cris/op_helper.c
index ea8016b4..abcf9b47 100644
--- a/qemu/target-cris/op_helper.c
+++ b/qemu/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/qemu/target-i386/helper.c b/qemu/target-i386/helper.c
index 4562a16a..cab085ad 100644
--- a/qemu/target-i386/helper.c
+++ b/qemu/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/qemu/target-m68k/op_helper.c b/qemu/target-m68k/op_helper.c
index f45c4d97..f2e9f035 100644
--- a/qemu/target-m68k/op_helper.c
+++ b/qemu/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/qemu/target-mips/op_helper.c b/qemu/target-mips/op_helper.c
index 017d12ad..2020e9ef 100644
--- a/qemu/target-mips/op_helper.c
+++ b/qemu/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/qemu/target-ppc/op_helper.c b/qemu/target-ppc/op_helper.c
index 544d9066..1c081728 100644
--- a/qemu/target-ppc/op_helper.c
+++ b/qemu/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/qemu/target-sh4/op_helper.c b/qemu/target-sh4/op_helper.c
index bbc30302..8c8318f1 100644
--- a/qemu/target-sh4/op_helper.c
+++ b/qemu/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/qemu/target-sparc/op_helper.c b/qemu/target-sparc/op_helper.c
index 2d855606..250f7196 100644
--- a/qemu/target-sparc/op_helper.c
+++ b/qemu/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/qemu/tcg/arm/tcg-target.c b/qemu/tcg/arm/tcg-target.c
index a3f4c6d4..3ced47ef 100644
--- a/qemu/tcg/arm/tcg-target.c
+++ b/qemu/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);