This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Use R*_LP on pointers in __longjmp.S and setjmp.S


On Tue, May 15, 2012 at 9:39 AM, Roland McGrath <roland@hack.frob.com> wrote:
>> ? ? ? movq (JB_RBP*8)(%rdi),%r9
>> ? ? ? movq (JB_PC*8)(%rdi),%rdx
>
> It saves a byte to make this:
>
> ? ? ? ?mov (JB_PC*8)(%rdi),%RDX_LP
>
> It makes no difference but is consistent to do it for the JB_RSP and JB_RBP
> loads too, so might as well.
>

Here is the updated patch to use R*_LP on all pointers.  Tested
on Linux/x86-64 and Linux/x32.  OK to install?

Thanks.

-- 
H.J.
----
	* sysdeps/x86_64/__longjmp.S: Use R*_LP on pointers.
	* sysdeps/x86_64/setjmp.S: Likewise.

diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index 3963f9c..61b8768 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -25,13 +25,13 @@
 	.text
 ENTRY(__longjmp)
 	/* Restore registers.  */
-	movq (JB_RSP*8)(%rdi),%r8
-	movq (JB_RBP*8)(%rdi),%r9
-	movq (JB_PC*8)(%rdi),%rdx
+	mov (JB_RSP*8)(%rdi),%R8_LP
+	mov (JB_RBP*8)(%rdi),%R9_LP
+	mov (JB_PC*8)(%rdi),%RDX_LP
 #ifdef PTR_DEMANGLE
-	PTR_DEMANGLE (%r8)
-	PTR_DEMANGLE (%r9)
-	PTR_DEMANGLE (%rdx)
+	PTR_DEMANGLE (%R8_LP)
+	PTR_DEMANGLE (%R9_LP)
+	PTR_DEMANGLE (%RDX_LP)
 #endif
 	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
index 1902d14..bd78073 100644
--- a/sysdeps/x86_64/setjmp.S
+++ b/sysdeps/x86_64/setjmp.S
@@ -24,8 +24,8 @@ ENTRY (__sigsetjmp)
 	/* Save registers.  */
 	movq %rbx, (JB_RBX*8)(%rdi)
 #ifdef PTR_MANGLE
-	movq %rbp, %rax
-	PTR_MANGLE (%rax)
+	mov %RBP_LP, %RAX_LP
+	PTR_MANGLE (%RAX_LP)
 	movq %rax, (JB_RBP*8)(%rdi)
 #else
 	movq %rbp, (JB_RBP*8)(%rdi)
@@ -34,14 +34,14 @@ ENTRY (__sigsetjmp)
 	movq %r13, (JB_R13*8)(%rdi)
 	movq %r14, (JB_R14*8)(%rdi)
 	movq %r15, (JB_R15*8)(%rdi)
-	leaq 8(%rsp), %rdx	/* Save SP as it will be after we return.  */
+	lea 8(%rsp), %RDX_LP	/* Save SP as it will be after we return.  */
 #ifdef PTR_MANGLE
-	PTR_MANGLE (%rdx)
+	PTR_MANGLE (%RDX_LP)
 #endif
 	movq %rdx, (JB_RSP*8)(%rdi)
-	movq (%rsp), %rax	/* Save PC we are returning to now.  */
+	mov (%rsp), %RAX_LP	/* Save PC we are returning to now.  */
 #ifdef PTR_MANGLE
-	PTR_MANGLE (%rax)
+	PTR_MANGLE (%RAX_LP)
 #endif
 	movq %rax, (JB_PC*8)(%rdi)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]