movq (%rsp), %rax
movq %rax, JB_RIP(%rdi)
// RSP is set to the frame return address plus 8
- movq %rsp, %rax
- addq $8, %rax
+ leaq 8(%rsp), %rax
movq %rax, JB_RSP(%rdi)
- // save rflags - you can't use movq
- pushfq
- popq %rax
- movq %rax, JB_RFLAGS(%rdi)
-
// save fp control word
fnstcw JB_FPCONTROL(%rdi)
stmxcsr JB_MXCSR(%rdi)
// return 0
- xorq %rax, %rax
+ xorl %eax, %eax
ret
LEAF(__longjmp, 0)
- fninit // reset FP coprocessor
-
+ fninit // Clear all FP exceptions
// %rdi is a jmp_buf (struct sigcontext *)
- // %rsi is the return value
- movq %rsi, %rax
- testq %rax, %rax
+ // %esi is the return value
+ movl %esi, %eax
+ testl %esi, %esi
jnz 1f
- addq $1, %rax
+ incl %eax
// general registers
1:
// restore MXCSR
ldmxcsr JB_MXCSR(%rdi)
- // rflags
- pushq JB_RFLAGS(%rdi)
- popfq
+
+ // Make sure DF is reset
+ cld
jmp *JB_RIP(%rdi)