qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [4570] Fix off-by-one unwinding error.


From: Paul Brook
Subject: [Qemu-devel] [4570] Fix off-by-one unwinding error.
Date: Sun, 25 May 2008 00:36:07 +0000

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.c

Modified: trunk/dyngen-exec.h
===================================================================
--- trunk/dyngen-exec.h 2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/dyngen-exec.h 2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-alpha/op_helper.c      2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-alpha/op_helper.c      2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-arm/op_helper.c        2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-arm/op_helper.c        2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-cris/op_helper.c       2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-cris/op_helper.c       2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-i386/helper.c  2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-i386/helper.c  2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-m68k/op_helper.c       2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-m68k/op_helper.c       2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-mips/op_helper.c       2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-mips/op_helper.c       2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-ppc/op_helper.c        2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-ppc/op_helper.c        2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-sh4/op_helper.c        2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-sh4/op_helper.c        2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/target-sparc/op_helper.c      2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/target-sparc/op_helper.c      2008-05-25 00:36:06 UTC (rev 4570)
@@ -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
===================================================================
--- trunk/tcg/arm/tcg-target.c  2008-05-25 00:14:34 UTC (rev 4569)
+++ trunk/tcg/arm/tcg-target.c  2008-05-25 00:36:06 UTC (rev 4570)
@@ -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);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]