scheduler: handle userland thread exit

This commit is contained in:
Matheus
2024-04-14 14:00:11 -03:00
parent d33ef16f87
commit 2cb94c2c2e
5 changed files with 68 additions and 37 deletions
+3
View File
@@ -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
+5
View File
@@ -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