mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 05:58:22 +00:00
scheduler: handle userland thread exit
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
section .text
|
||||
global arch_context_switch
|
||||
arch_context_switch:
|
||||
extern sched_userspacecheck
|
||||
call sched_userspacecheck ; compiled with no_caller_saved_registers
|
||||
|
||||
; rdi is the pointer to the context struct
|
||||
mov rsp, rdi
|
||||
|
||||
|
||||
@@ -195,6 +195,11 @@ arch_syscall_entry:
|
||||
extern arch_syscall_log_return
|
||||
call arch_syscall_log_return ; compiled with __attribute__((no_caller_saved_registers))
|
||||
|
||||
mov rdi, rsp
|
||||
add rdi, 8 ; context pointer is after r9 argument
|
||||
extern sched_userspacecheck
|
||||
call sched_userspacecheck ; compiled with __attribute__((no_caller_saved_registers))
|
||||
|
||||
; restore context
|
||||
add rsp, 32 ; r9 argument, cr2, gs, and fs are not popped.
|
||||
pop rbx
|
||||
|
||||
Reference in New Issue
Block a user