]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/x86_64/machine_routines_asm.s
xnu-6153.141.1.tar.gz
[apple/xnu.git] / osfmk / x86_64 / machine_routines_asm.s
index af962f2f44238dc46b88b3fe701941950163045e..c0a1bdc90cde088a4d5a3440406f126ec61ed2ca 100644 (file)
@@ -175,18 +175,40 @@ ENTRY(_rtc_tsc_to_nanoseconds)
        shrdq   $32,%rdx,%rax                   /* %rdx:%rax >>= 32 */
        ret
     
        shrdq   $32,%rdx,%rax                   /* %rdx:%rax >>= 32 */
        ret
     
-    
+
+/*
+ *  typedef void (*thread_continue_t)(void *param, wait_result_t)
+ *
+ *     void call_continuation( thread_continue_t continuation,
+ *                                     void *param,
+ *                                         wait_result_t wresult,
+ *                          bool enable interrupts)
+ */
 
 Entry(call_continuation)
 
 Entry(call_continuation)
-       movq    %rdi,%rcx                       /* get continuation */
-       movq    %rsi,%rdi                       /* continuation param */
-       movq    %rdx,%rsi                       /* wait result */
+
+       movq    %rdi, %r12  /* continuation */
+    movq    %rsi, %r13  /* continuation param */
+    movq    %rdx, %r14  /* wait result */
+
        movq    %gs:CPU_KERNEL_STACK,%rsp       /* set the stack */
        xorq    %rbp,%rbp                       /* zero frame pointer */
        movq    %gs:CPU_KERNEL_STACK,%rsp       /* set the stack */
        xorq    %rbp,%rbp                       /* zero frame pointer */
+
+    test    %ecx, %ecx
+    jz 1f
+    mov     $1, %edi
+    call   _ml_set_interrupts_enabled
+1:
+
+       movq    %r12,%rcx                       /* continuation */
+       movq    %r13,%rdi                       /* continuation param */
+       movq    %r14,%rsi                       /* wait result */
+
        call    *%rcx                           /* call continuation */
        movq    %gs:CPU_ACTIVE_THREAD,%rdi
        call    EXT(thread_terminate)
 
        call    *%rcx                           /* call continuation */
        movq    %gs:CPU_ACTIVE_THREAD,%rdi
        call    EXT(thread_terminate)
 
+
 Entry(x86_init_wrapper)
        xor     %rbp, %rbp
        movq    %rsi, %rsp
 Entry(x86_init_wrapper)
        xor     %rbp, %rbp
        movq    %rsi, %rsp