Index: newlib/libc/machine/x86_64/setjmp.S |
diff --git a/newlib/libc/machine/x86_64/setjmp.S b/newlib/libc/machine/x86_64/setjmp.S |
index b1d26adba38b905d3b269ded44f305b06de6b240..5f03c3e66bc4cb7c3f15370aa2129887551e4b2e 100644 |
--- a/newlib/libc/machine/x86_64/setjmp.S |
+++ b/newlib/libc/machine/x86_64/setjmp.S |
@@ -26,9 +26,10 @@ SYM (setjmp): |
movq r12, %nacl: 8 (r15,rdi) |
movq r13, %nacl: 16 (r15,rdi) |
movq r14, %nacl: 24 (r15,rdi) |
- movq (rsp), rax |
- movq rax, %nacl: 32 (r15,rdi) |
- leaq 8 (rsp), rax |
+ /* Avoid writing the top 32 bits of rip, rbp, and rsp into memory. */ |
+ movl (rsp), eax |
Mark Seaborn
2015/02/11 02:23:45
Note: shorter as:
popq %rax
movl eax, %nacl: 3
Derek Schuff
2015/02/11 23:16:06
Done.
|
+ movl eax, %nacl: 32 (r15,rdi) |
+ leal 8 (rsp), eax |
movl ebp, %nacl: 40 (r15,rdi) |
movl eax, %nacl: 44 (r15,rdi) |
movq $0, rax |
@@ -36,7 +37,11 @@ SYM (setjmp): |
nacljmp r11d, r15 |
SYM (longjmp): |
- movq rsi, rax /* Return value */ |
+ movl esi, eax /* Return value */ |
Mark Seaborn
2015/02/11 02:23:45
I'm not sure why you're changing this. It looks l
Derek Schuff
2015/02/11 18:19:11
Yes, I noticed that it didn't conform and decided
|
+ /* if val is zero, we must return 1 -- otherwise return val */ |
+ movl $1, ebx |
+ testl eax, eax |
+ cmovz ebx, eax |
naclrestbp %nacl: 40 (r15,rdi), r15 |