[4570] Fix off-by-one unwinding error.
Revision: 4570
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4570 Author: pbrook Date: 2008-05-25 00:36:06 +0000 (Sun, 25 May 2008)
Log Message:
-----------
Fix off-by-one unwinding error.
Modified Paths:
--------------
trunk/dyngen-exec.h
trunk/target-alpha/op_helper.c
trunk/target-arm/op_helper.c
trunk/target-cris/op_helper.c
trunk/target-i386/helper.c
trunk/target-m68k/op_helper.c
trunk/target-mips/op_helper.c
trunk/target-ppc/op_helper.c
trunk/target-sh4/op_helper.c
trunk/target-sparc/op_helper.c
trunk/tcg/arm/tcg-target.cModified: trunk/dyngen-exec.h
===================================================================
dyngen-exec.h +12 -0
@@ -287,4 +287,16 @@#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__) */
Modified: trunk/target-alpha/op_helper.c
===================================================================
target-alpha/op_helper.c +0 -6
@@ -1093,12 +1093,6 @@/* 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.
Modified: trunk/target-arm/op_helper.c
===================================================================
target-arm/op_helper.c +0 -5
@@ -68,11 +68,6 @@#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"
Modified: trunk/target-cris/op_helper.c
===================================================================
target-cris/op_helper.c +0 -5
@@ -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"
Modified: trunk/target-i386/helper.c
===================================================================
target-i386/helper.c +0 -5
@@ -4663,11 +4663,6 @@#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"
Modified: trunk/target-m68k/op_helper.c
===================================================================
target-m68k/op_helper.c +0 -5
@@ -32,11 +32,6 @@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"
Modified: trunk/target-mips/op_helper.c
===================================================================
target-mips/op_helper.c +0 -6
@@ -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 */
Modified: trunk/target-ppc/op_helper.c
===================================================================
target-ppc/op_helper.c +0 -5
@@ -2612,11 +2612,6 @@#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"
Modified: trunk/target-sh4/op_helper.c
===================================================================
target-sh4/op_helper.c +0 -5
@@ -28,11 +28,6 @@#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"
Modified: trunk/target-sparc/op_helper.c
===================================================================
target-sparc/op_helper.c +0 -6
@@ -2871,12 +2871,6 @@#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"
Modified: trunk/tcg/arm/tcg-target.c
===================================================================
tcg/arm/tcg-target.c +0 -1
@@ -1180,7 +1180,6 @@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 );