X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3e170ce000f1506b7b5d2c5c7faec85ceabb573d..0a7de7458d150b5d4dffc935ba399be265ef0a1a:/osfmk/x86_64/cswitch.s diff --git a/osfmk/x86_64/cswitch.s b/osfmk/x86_64/cswitch.s index 88d88060c..cb72f459e 100644 --- a/osfmk/x86_64/cswitch.s +++ b/osfmk/x86_64/cswitch.s @@ -69,9 +69,9 @@ Entry(Load_context) movq %rdx,%gs:CPU_KERNEL_STACK /* store stack top */ movq %rdx,%rsp - movq %rdx,%rbp + xorl %ebp, %ebp - xorq %rdi,%rdi /* return zero (no old thread) */ + xorl %edi,%edi /* return zero (no old thread) */ call EXT(thread_continue) @@ -118,7 +118,7 @@ Entry(Switch_context) Entry(Thread_continue) - movq %rax, %rdi /* load thread argument */ + movq %rax, %rdi /* this is the old thread from Switch_context */ xorq %rbp,%rbp /* zero frame pointer */ call *%rbx /* call real continuation */ @@ -152,6 +152,9 @@ Entry(Shutdown_context) movq %gs:CPU_INT_STACK_TOP,%rsp /* switch to interrupt stack */ + movq %rsp, %gs:CPU_ACTIVE_STACK + movq EXT(kernel_stack_size)(%rip),%rcx /* point to stack top */ + subq %rcx, %gs:CPU_ACTIVE_STACK movq %rdx,%rdi /* processor arg to routine */ call *%rsi /* call routine to run */ hlt /* (should never return) */