Kernel: Use syscall/sysret for syscalls in x86_64

This commit is contained in:
2026-01-09 15:15:46 +02:00
parent 94bd74d0bb
commit a9ceab0415
19 changed files with 178 additions and 149 deletions

View File

@@ -15,9 +15,7 @@ asm_syscall_handler:
andl $-16, %esp
# push arguments
subl $4, %esp
pushl %ebp
addl $24, (%esp)
subl $8, %esp
pushl %edi
pushl %esi
pushl %edx
@@ -65,7 +63,7 @@ sys_fork_trampoline:
call read_ip
testl %eax, %eax
jz .reload_stack
jz .done
movl %esp, %ebx
@@ -81,9 +79,3 @@ sys_fork_trampoline:
popl %ebx
popl %ebp
ret
.reload_stack:
call get_thread_start_sp
movl %eax, %esp
xorl %eax, %eax
jmp .done

View File

@@ -1,6 +1,6 @@
.macro maybe_load_kernel_segments, n
cmpb $0x08, \n(%esp)
je 1f
testb $3, \n(%esp)
jz 1f; jnp 1f
movw $0x10, %ax
movw %ax, %ds
@@ -13,8 +13,8 @@
.endm
.macro maybe_load_userspace_segments, n
cmpb $0x08, \n(%esp)
je 1f
testb $3, \n(%esp)
jz 1f; jnp 1f
movw $(0x20 | 3), %bx
movw %bx, %ds