Commit 9b7b85d26006af61b69dbabe2354d73a8c67cc6c
1 parent
8bba5c81
Fix off-by-one unwinding error.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4570 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
11 changed files
with
12 additions
and
49 deletions
dyngen-exec.h
... | ... | @@ -287,4 +287,16 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3; |
287 | 287 | #error unsupported CPU |
288 | 288 | #endif |
289 | 289 | |
290 | +/* The return address may point to the start of the next instruction. | |
291 | + Subtracting one gets us the call instruction itself. */ | |
292 | +#if defined(__s390__) | |
293 | +# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1)) | |
294 | +#elif defined(__arm__) | |
295 | +/* Thumb return addresses have the low bit set, so we need to subtract two. | |
296 | + This is still safe in ARM mode because instructions are 4 bytes. */ | |
297 | +# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 2)) | |
298 | +#else | |
299 | +# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1)) | |
300 | +#endif | |
301 | + | |
290 | 302 | #endif /* !defined(__DYNGEN_EXEC_H__) */ | ... | ... |
target-alpha/op_helper.c
... | ... | @@ -1093,12 +1093,6 @@ void helper_reset_FT2 (void) |
1093 | 1093 | /* Softmmu support */ |
1094 | 1094 | #if !defined (CONFIG_USER_ONLY) |
1095 | 1095 | |
1096 | -#ifdef __s390__ | |
1097 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
1098 | -#else | |
1099 | -# define GETPC() (__builtin_return_address(0)) | |
1100 | -#endif | |
1101 | - | |
1102 | 1096 | /* XXX: the two following helpers are pure hacks. |
1103 | 1097 | * Hopefully, we emulate the PALcode, then we should never see |
1104 | 1098 | * HW_LD / HW_ST instructions. | ... | ... |
target-arm/op_helper.c
... | ... | @@ -68,11 +68,6 @@ uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, |
68 | 68 | #if !defined(CONFIG_USER_ONLY) |
69 | 69 | |
70 | 70 | #define MMUSUFFIX _mmu |
71 | -#ifdef __s390__ | |
72 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
73 | -#else | |
74 | -# define GETPC() (__builtin_return_address(0)) | |
75 | -#endif | |
76 | 71 | |
77 | 72 | #define SHIFT 0 |
78 | 73 | #include "softmmu_template.h" | ... | ... |
target-cris/op_helper.c
... | ... | @@ -24,11 +24,6 @@ |
24 | 24 | #include "mmu.h" |
25 | 25 | |
26 | 26 | #define MMUSUFFIX _mmu |
27 | -#ifdef __s390__ | |
28 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
29 | -#else | |
30 | -# define GETPC() (__builtin_return_address(0)) | |
31 | -#endif | |
32 | 27 | |
33 | 28 | #define SHIFT 0 |
34 | 29 | #include "softmmu_template.h" | ... | ... |
target-i386/helper.c
... | ... | @@ -4663,11 +4663,6 @@ static float approx_rcp(float a) |
4663 | 4663 | #if !defined(CONFIG_USER_ONLY) |
4664 | 4664 | |
4665 | 4665 | #define MMUSUFFIX _mmu |
4666 | -#ifdef __s390__ | |
4667 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
4668 | -#else | |
4669 | -# define GETPC() (__builtin_return_address(0)) | |
4670 | -#endif | |
4671 | 4666 | |
4672 | 4667 | #define SHIFT 0 |
4673 | 4668 | #include "softmmu_template.h" | ... | ... |
target-m68k/op_helper.c
... | ... | @@ -32,11 +32,6 @@ void do_interrupt(int is_hw) |
32 | 32 | extern int semihosting_enabled; |
33 | 33 | |
34 | 34 | #define MMUSUFFIX _mmu |
35 | -#ifdef __s390__ | |
36 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
37 | -#else | |
38 | -# define GETPC() (__builtin_return_address(0)) | |
39 | -#endif | |
40 | 35 | |
41 | 36 | #define SHIFT 0 |
42 | 37 | #include "softmmu_template.h" | ... | ... |
target-mips/op_helper.c
... | ... | @@ -22,12 +22,6 @@ |
22 | 22 | |
23 | 23 | #include "host-utils.h" |
24 | 24 | |
25 | -#ifdef __s390__ | |
26 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
27 | -#else | |
28 | -# define GETPC() (__builtin_return_address(0)) | |
29 | -#endif | |
30 | - | |
31 | 25 | /*****************************************************************************/ |
32 | 26 | /* Exceptions processing helpers */ |
33 | 27 | ... | ... |
target-ppc/op_helper.c
... | ... | @@ -2612,11 +2612,6 @@ DO_SPE_OP1(fsctuf); |
2612 | 2612 | #if !defined (CONFIG_USER_ONLY) |
2613 | 2613 | |
2614 | 2614 | #define MMUSUFFIX _mmu |
2615 | -#ifdef __s390__ | |
2616 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
2617 | -#else | |
2618 | -# define GETPC() (__builtin_return_address(0)) | |
2619 | -#endif | |
2620 | 2615 | |
2621 | 2616 | #define SHIFT 0 |
2622 | 2617 | #include "softmmu_template.h" | ... | ... |
target-sh4/op_helper.c
... | ... | @@ -28,11 +28,6 @@ void do_raise_exception(void) |
28 | 28 | #ifndef CONFIG_USER_ONLY |
29 | 29 | |
30 | 30 | #define MMUSUFFIX _mmu |
31 | -#ifdef __s390__ | |
32 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & 0x7fffffffUL)) | |
33 | -#else | |
34 | -# define GETPC() (__builtin_return_address(0)) | |
35 | -#endif | |
36 | 31 | |
37 | 32 | #define SHIFT 0 |
38 | 33 | #include "softmmu_template.h" | ... | ... |
target-sparc/op_helper.c
... | ... | @@ -2871,12 +2871,6 @@ static void do_unaligned_access(target_ulong addr, int is_write, int is_user, |
2871 | 2871 | |
2872 | 2872 | #define MMUSUFFIX _mmu |
2873 | 2873 | #define ALIGNED_ONLY |
2874 | -#ifdef __s390__ | |
2875 | -# define GETPC() ((void*)((unsigned long)__builtin_return_address(0) & \ | |
2876 | - 0x7fffffffUL)) | |
2877 | -#else | |
2878 | -# define GETPC() (__builtin_return_address(0)) | |
2879 | -#endif | |
2880 | 2874 | |
2881 | 2875 | #define SHIFT 0 |
2882 | 2876 | #include "softmmu_template.h" | ... | ... |
tcg/arm/tcg-target.c
... | ... | @@ -1180,7 +1180,6 @@ static inline void tcg_out_qemu_st(TCGContext *s, int cond, |
1180 | 1180 | |
1181 | 1181 | tcg_out_bl(s, cond, (tcg_target_long) qemu_st_helpers[s_bits] - |
1182 | 1182 | (tcg_target_long) s->code_ptr); |
1183 | - | |
1184 | 1183 | # if TARGET_LONG_BITS == 64 |
1185 | 1184 | if (opc == 3) |
1186 | 1185 | tcg_out_dat_imm(s, cond, ARITH_ADD, 13, 13, 0x10); | ... | ... |