Kernel: Properly update the stored thread rbp when switching contexts

This commit is contained in:
Tim Schumacher 2023-04-17 15:10:40 +02:00 committed by Andreas Kling
parent 50b7183bd1
commit 0ee476948b
Notes: sideshowbarker 2024-07-17 01:46:43 +09:00

View file

@ -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),