aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-12-28 19:13:20 +0000
committerUlrich Drepper <drepper@redhat.com>2005-12-28 19:13:20 +0000
commit272b289859eff42d77fac6cf3125b38b0ff01791 (patch)
tree0af9bdc2118abfc0f8a30e799944fa74d1383ad1
parent4973f319536a5dc555fe3980615677b12e5359e4 (diff)
downloadglibc-272b289859eff42d77fac6cf3125b38b0ff01791.zip
glibc-272b289859eff42d77fac6cf3125b38b0ff01791.tar.gz
glibc-272b289859eff42d77fac6cf3125b38b0ff01791.tar.bz2
* sysdeps/i386/__longjmp.S [PTR_DEMANGLE]: Also demangle stack
pointer. Add CFI. * sysdeps/i386/bsd-_setjmp.S [PTR_MANGLE]: Also mangle stack pointer. * sysdeps/i386/bsd-setjmp.S: Likewise. * sysdeps/i386/setjmp.S: Likewise.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/i386/__longjmp.S32
-rw-r--r--sysdeps/i386/bsd-_setjmp.S3
-rw-r--r--sysdeps/i386/bsd-setjmp.S3
-rw-r--r--sysdeps/i386/setjmp.S3
5 files changed, 45 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 27e2ad4..dfdb271 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2005-12-28 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/i386/__longjmp.S [PTR_DEMANGLE]: Also demangle stack
+ pointer. Add CFI.
+ * sysdeps/i386/bsd-_setjmp.S [PTR_MANGLE]: Also mangle stack pointer.
+ * sysdeps/i386/bsd-setjmp.S: Likewise.
+ * sysdeps/i386/setjmp.S: Likewise.
+
* sysdeps/x86_64/__longjmp.S: No need to make sure return value is
!= 0, the caller did that.
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index aced5f4..10a4650 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -32,6 +32,36 @@
ENTRY (BP_SYM (__longjmp))
ENTER
+#ifdef PTR_DEMANGLE
+ movl JBUF(%esp), %eax /* User's jmp_buf in %eax. */
+ CHECK_BOUNDS_BOTH_WIDE (%eax, JBUF(%esp), $JB_SIZE)
+
+ /* Save the return address now. */
+ movl (JB_PC*4)(%eax), %edx
+ /* Get the stack pointer. */
+ movl (JB_SP*4)(%eax), %ecx
+ PTR_DEMANGLE (%edx)
+ PTR_DEMANGLE (%ecx)
+ cfi_def_cfa(%eax, 0)
+ cfi_register(%eip, %edx)
+ cfi_register(%esp, %ecx)
+ cfi_offset(%ebx, JB_BX*4)
+ cfi_offset(%esi, JB_SI*4)
+ cfi_offset(%edi, JB_DI*4)
+ cfi_offset(%ebp, JB_BP*4)
+ /* Restore registers. */
+ movl (JB_BX*4)(%eax), %ebx
+ movl (JB_SI*4)(%eax), %esi
+ movl (JB_DI*4)(%eax), %edi
+ movl (JB_BP*4)(%eax), %ebp
+ cfi_restore(%ebx)
+ cfi_restore(%esi)
+ cfi_restore(%edi)
+ cfi_restore(%ebp)
+
+ movl VAL(%esp), %eax /* Second argument is return value. */
+ movl %ecx, %esp
+#else
movl JBUF(%esp), %ecx /* User's jmp_buf in %ecx. */
CHECK_BOUNDS_BOTH_WIDE (%ecx, JBUF(%esp), $JB_SIZE)
@@ -44,8 +74,6 @@ ENTRY (BP_SYM (__longjmp))
movl (JB_DI*4)(%ecx), %edi
movl (JB_BP*4)(%ecx), %ebp
movl (JB_SP*4)(%ecx), %esp
-#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (%edx)
#endif
/* Jump to saved PC. */
jmp *%edx
diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
index f80d239..99cc791 100644
--- a/sysdeps/i386/bsd-_setjmp.S
+++ b/sysdeps/i386/bsd-_setjmp.S
@@ -44,6 +44,9 @@ ENTRY (BP_SYM (_setjmp))
movl %esi, (JB_SI*4)(%edx)
movl %edi, (JB_DI*4)(%edx)
leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */
+#ifdef PTR_MANGLE
+ PTR_MANGLE (%ecx)
+#endif
movl %ecx, (JB_SP*4)(%edx)
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
#ifdef PTR_MANGLE
diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
index f4257a0..02c76a8 100644
--- a/sysdeps/i386/bsd-setjmp.S
+++ b/sysdeps/i386/bsd-setjmp.S
@@ -46,6 +46,9 @@ ENTRY (BP_SYM (setjmp))
movl %esi, (JB_SI*4)(%eax)
movl %edi, (JB_DI*4)(%eax)
leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */
+#ifdef PTR_MANGLE
+ PTR_MANGLE (%ecx)
+#endif
movl %ecx, (JB_SP*4)(%eax)
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
#ifdef PTR_MANGLE
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 747499a..94dcbf2 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -40,6 +40,9 @@ ENTRY (BP_SYM (__sigsetjmp))
movl %esi, (JB_SI*4)(%eax)
movl %edi, (JB_DI*4)(%eax)
leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */
+#ifdef PTR_MANGLE
+ PTR_MANGLE (%ecx)
+#endif
movl %ecx, (JB_SP*4)(%eax)
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
#ifdef PTR_MANGLE