X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/8e029c653e0567df7ce6933dde41f5830dbbbcda..1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58:/x86_64/sys/_setjmp.s diff --git a/x86_64/sys/_setjmp.s b/x86_64/sys/_setjmp.s index 7ebf81c..02cd31e 100644 --- a/x86_64/sys/_setjmp.s +++ b/x86_64/sys/_setjmp.s @@ -70,15 +70,9 @@ LEAF(__setjmp, 0) 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) @@ -86,19 +80,18 @@ LEAF(__setjmp, 0) 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: @@ -116,8 +109,8 @@ LEAF(__longjmp, 0) // restore MXCSR ldmxcsr JB_MXCSR(%rdi) - // rflags - pushq JB_RFLAGS(%rdi) - popfq + + // Make sure DF is reset + cld jmp *JB_RIP(%rdi)