X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/5c26bcd6e16a9635d747a67bbcec500e43b8e91f..cc9b6223b2987bd6f07ca869665f420285917156:/sys/platform/pc64/x86_64/exception.S diff --git a/sys/platform/pc64/x86_64/exception.S b/sys/platform/pc64/x86_64/exception.S index 55343042d2..8377d21325 100644 --- a/sys/platform/pc64/x86_64/exception.S +++ b/sys/platform/pc64/x86_64/exception.S @@ -48,6 +48,8 @@ .text + .globl lwkt_switch_return + /*****************************************************************************/ /* Trap handling */ /*****************************************************************************/ @@ -418,8 +420,17 @@ nmi_restoreregs: * * The MP lock is not held at any point but the critcount is bumped * on entry to prevent interruption of the trampoline at a bad point. + * + * This is effectively what td->td_switch() returns to. It 'returns' the + * old thread in %rax and since this is not returning to a td->td_switch() + * call from lwkt_switch() we must handle the cleanup for the old thread + * by calling lwkt_switch_return(). + * + * fork_trampoline(%rax:otd, %rbx:func, %r12:arg) */ ENTRY(fork_trampoline) + movq %rax,%rdi + call lwkt_switch_return movq PCPU(curthread),%rax decl TD_CRITCOUNT(%rax)