summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/setjmp.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/setjmp.S
parent07c58f8f3501329340bf3c69a347f7c8fdcbe528 (diff)
x32: Don't lose high bits of %rbp in setjmp/longjmp mangling/demangling.
Diffstat (limited to 'sysdeps/x86_64/setjmp.S')
-rw-r--r--sysdeps/x86_64/setjmp.S15
1 files changed, 11 insertions, 4 deletions
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
index 87c095238c..5639292da4 100644
--- a/sysdeps/x86_64/setjmp.S
+++ b/sysdeps/x86_64/setjmp.S
@@ -1,5 +1,5 @@
/* setjmp for x86-64.
- Copyright (C) 2001, 2003, 2005, 2006 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
@@ -24,9 +24,16 @@ ENTRY (__sigsetjmp)
/* Save registers. */
movq %rbx, (JB_RBX*8)(%rdi)
#ifdef PTR_MANGLE
- movq %rbp, %rax
- PTR_MANGLE (%rax)
- movq %rax, (JB_RBP*8)(%rdi)
+# ifdef __ILP32__
+ /* Save the high bits of %rbp first, since PTR_MANGLE will
+ only handle the low bits but we cannot presume %rbp is
+ being used as a pointer and truncate it. Here we write all
+ of %rbp, but the low bits will be overwritten below. */
+ movq %rbp, (JB_RBP*8)(%rdi)
+# endif
+ mov %RBP_LP, %RAX_LP
+ PTR_MANGLE (%RAX_LP)
+ mov %RAX_LP, (JB_RBP*8)(%rdi)
#else
movq %rbp, (JB_RBP*8)(%rdi)
#endif