about summary refs log tree commit diff
path: root/sysdeps/x86_64/__longjmp.S
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-05-18 15:32:08 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-21 13:04:11 -0700
commit6c7fb1458ddf7943dceac20440226d3d968e518d (patch)
tree1e0e39a4cd09c7a6426cfaa2db018247087a7dfd /sysdeps/x86_64/__longjmp.S
parent07c58f8f3501329340bf3c69a347f7c8fdcbe528 (diff)
downloadglibc-6c7fb1458ddf7943dceac20440226d3d968e518d.tar.gz
glibc-6c7fb1458ddf7943dceac20440226d3d968e518d.tar.xz
glibc-6c7fb1458ddf7943dceac20440226d3d968e518d.zip
x32: Don't lose high bits of %rbp in setjmp/longjmp mangling/demangling.
Diffstat (limited to 'sysdeps/x86_64/__longjmp.S')
-rw-r--r--sysdeps/x86_64/__longjmp.S14
1 files changed, 11 insertions, 3 deletions
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index 22beb888a1..c0c15dc810 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,12 +26,20 @@
 ENTRY(__longjmp)
 	/* Restore registers.  */
 	mov (JB_RSP*8)(%rdi),%R8_LP
-	movq (JB_RBP*8)(%rdi),%r9
+	mov (JB_RBP*8)(%rdi),%R9_LP
 	mov (JB_PC*8)(%rdi),%RDX_LP
 #ifdef PTR_DEMANGLE
 	PTR_DEMANGLE (%R8_LP)
-	PTR_DEMANGLE (%r9)
+	PTR_DEMANGLE (%R9_LP)
 	PTR_DEMANGLE (%RDX_LP)
+# ifdef __ILP32__
+	/* We ignored the high bits of the %rbp value because only the low
+	   bits are mangled.  But we cannot presume that %rbp is being used
+	   as a pointer and truncate it, so recover the high bits.  */
+	movl (JB_RBP*8 + 4)(%rdi), %eax
+	shlq $32, %rax
+	orq %rax, %r9
+# endif
 #endif
 	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)