Kernel: Implement syscalls for i686 and cleanup x86_64

This actually allows i686 to boot properly!
This commit is contained in:
2024-04-03 02:23:23 +03:00
parent 9e073e9fa0
commit 0dd74e3c9d
8 changed files with 120 additions and 48 deletions

View File

@@ -6,13 +6,16 @@ sys_fork_trampoline:
pushq %r13
pushq %r14
pushq %r15
call read_ip
testq %rax, %rax
je .done
je .reload_stack
movq %rax, %rsi
movq %rsp, %rdi
call sys_fork
.done:
.done:
popq %r15
popq %r14
popq %r13
@@ -20,3 +23,9 @@ sys_fork_trampoline:
popq %rbp
popq %rbx
ret
.reload_stack:
call get_thread_start_sp
movq %rax, %rsp
xorq %rax, %rax
jmp .done

View File

@@ -7,7 +7,7 @@ read_ip:
# void start_kernel_thread()
.global start_kernel_thread
start_kernel_thread:
call get_start_kernel_thread_sp
call get_thread_start_sp
movq %rax, %rsp
# STACK LAYOUT
@@ -27,7 +27,7 @@ start_kernel_thread:
.global start_userspace_thread
start_userspace_thread:
call get_start_kernel_thread_sp
call get_thread_start_sp
movq %rax, %rsp
# STACK LAYOUT