From 0ee476948bd1a2f2cb6e0ef65636d1c57514b3e9 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 17 Apr 2023 15:10:40 +0200 Subject: [PATCH] Kernel: Properly update the stored thread rbp when switching contexts --- Kernel/Arch/x86_64/Processor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Arch/x86_64/Processor.cpp b/Kernel/Arch/x86_64/Processor.cpp index f0fafca567..4bb7c09963 100644 --- a/Kernel/Arch/x86_64/Processor.cpp +++ b/Kernel/Arch/x86_64/Processor.cpp @@ -1723,6 +1723,7 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) "shrq $32, %%rbx \n" "movl %%ebx, %[tss_rsp0h] \n" "movq %[to_rsp], %%rsp \n" + "movq %%rbp, %[from_rbp] \n" "pushq %[to_thread] \n" "pushq %[from_thread] \n" "pushq %[to_rip] \n" @@ -1748,6 +1749,7 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) "popq %%rbx \n" "popfq \n" : [from_rsp] "=m" (from_thread->regs().rsp), + [from_rbp] "=m" (from_thread->regs().rbp), [from_rip] "=m" (from_thread->regs().rip), [tss_rsp0l] "=m" (m_tss.rsp0l), [tss_rsp0h] "=m" (m_tss.rsp0h),