sched: improve thread handling on system calls

This commit is contained in:
Michael Shaw 2025-02-11 18:58:00 -05:00
commit 72827c1e00
9 changed files with 157 additions and 180 deletions

View file

@ -256,6 +256,13 @@ gate_syscall_int80:
save_context
save_iretq_frame
/* switch to a kernel process */
movq %rax, %rdi
movq $_gate_syscall_int80_entry_ret, %rsi
call proc_enter_kernel
_gate_syscall_int80_entry_ret:
movq %rdi, %rax
/* restore argument registers */
movq 40(%rax), %rdi
movq 32(%rax), %rsi
@ -269,6 +276,12 @@ gate_syscall_int80:
call syscall
/* switch back to user process */
movq %rax, %rdi
movq $1, %rsi
cli
call proc_leave_kernel
restore_iretq_frame
pushq %rax
restore_context
@ -332,8 +345,3 @@ _return_to_user:
yield:
hlt
jmp yield
.global _kthread_exit
_kthread_exit:
movq %rax, %rdi
call kthread_exit