From a08b9b82a64fbda88a783689af97977812cc6b38 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 19 Jan 2026 00:47:00 +0200 Subject: [PATCH] Kernel: Fix yield stack pointer value Stack pointer was pointing to value of return address on return instead of past it. This did not affect anything as ig Processor::yield() didn't use stack after calling the trampoline --- kernel/arch/i686/Yield.S | 4 ++-- kernel/arch/x86_64/Yield.S | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/arch/i686/Yield.S b/kernel/arch/i686/Yield.S index 68b352be..3a577637 100644 --- a/kernel/arch/i686/Yield.S +++ b/kernel/arch/i686/Yield.S @@ -1,9 +1,9 @@ .global asm_yield_trampoline asm_yield_trampoline: - movl %esp, %ecx + leal 4(%esp), %ecx movl 4(%esp), %esp - pushl (%ecx) + pushl -4(%ecx) pushl %ecx pushl %eax pushl %ebx diff --git a/kernel/arch/x86_64/Yield.S b/kernel/arch/x86_64/Yield.S index bec190c4..11c57ff1 100644 --- a/kernel/arch/x86_64/Yield.S +++ b/kernel/arch/x86_64/Yield.S @@ -1,10 +1,10 @@ .global asm_yield_trampoline asm_yield_trampoline: - movq %rsp, %rcx + leaq 8(%rsp), %rcx movq %rdi, %rsp subq $8, %rsp - pushq (%rcx) + pushq -8(%rcx) pushq %rcx pushq %rax pushq %rbx