Kernel: Remove unnecessary stack pointer loading

Any time I started a thread I was loading the stack pointer which is
already correctly passed :D
This commit is contained in:
2026-04-04 22:50:58 +03:00
parent a29681a524
commit 9d83424346
5 changed files with 2 additions and 26 deletions

View File

@@ -63,7 +63,7 @@ sys_fork_trampoline:
call read_ip call read_ip
testl %eax, %eax testl %eax, %eax
jz .reload_stack jz .done
movl %esp, %ebx movl %esp, %ebx
@@ -79,9 +79,3 @@ sys_fork_trampoline:
popl %ebx popl %ebx
popl %ebp popl %ebp
ret ret
.reload_stack:
call get_thread_start_sp
movl %eax, %esp
xorl %eax, %eax
jmp .done

View File

@@ -7,9 +7,6 @@ read_ip:
# void start_kernel_thread() # void start_kernel_thread()
.global start_kernel_thread .global start_kernel_thread
start_kernel_thread: start_kernel_thread:
call get_thread_start_sp
movl %eax, %esp
# STACK LAYOUT # STACK LAYOUT
# on_exit arg # on_exit arg
# on_exit func # on_exit func
@@ -34,9 +31,6 @@ start_kernel_thread:
.global start_userspace_thread .global start_userspace_thread
start_userspace_thread: start_userspace_thread:
call get_thread_start_sp
movl %eax, %esp
movw $(0x20 | 3), %bx movw $(0x20 | 3), %bx
movw %bx, %ds movw %bx, %ds
movw %bx, %es movw %bx, %es

View File

@@ -33,7 +33,7 @@ sys_fork_trampoline:
call read_ip call read_ip
testq %rax, %rax testq %rax, %rax
je .done jz .done
movq %rax, %rsi movq %rax, %rsi
movq %rsp, %rdi movq %rsp, %rdi

View File

@@ -7,9 +7,6 @@ read_ip:
# void start_kernel_thread() # void start_kernel_thread()
.global start_kernel_thread .global start_kernel_thread
start_kernel_thread: start_kernel_thread:
call get_thread_start_sp
movq %rax, %rsp
# STACK LAYOUT # STACK LAYOUT
# on_exit arg # on_exit arg
# on_exit func # on_exit func
@@ -27,9 +24,5 @@ start_kernel_thread:
.global start_userspace_thread .global start_userspace_thread
start_userspace_thread: start_userspace_thread:
call get_thread_start_sp
movq %rax, %rsp
swapgs swapgs
iretq iretq

View File

@@ -25,11 +25,6 @@ namespace Kernel
*(uintptr_t*)rsp = (uintptr_t)value; *(uintptr_t*)rsp = (uintptr_t)value;
} }
extern "C" uintptr_t get_thread_start_sp()
{
return Thread::current().yield_registers().sp;
}
static pid_t s_next_tid = 1; static pid_t s_next_tid = 1;
alignas(16) static uint8_t s_default_sse_storage[512]; alignas(16) static uint8_t s_default_sse_storage[512];