summaryrefslogtreecommitdiff
path: root/Kernel/Arch/x86/i386
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-08 22:22:38 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-09 13:22:22 +0200
commitf27e7bbbf431fc061bcb102c4533a58bb7101163 (patch)
treeb9083f7612407e5be9292df8fcd5b213e4ed1607 /Kernel/Arch/x86/i386
parentcd0fc7f52c8d5376ad7fa4287932e00674ebff9a (diff)
downloadserenity-f27e7bbbf431fc061bcb102c4533a58bb7101163.zip
Kernel/SMP: Don't enable interrupts in Processor::exit_trap
Enter a critical section in Processor::exit_trap so that processing SMP messages doesn't enable interrupts upon leaving. We need to delay this until the end where we call into the Scheduler if exiting the trap results in being outside of a critical section and irq handler. Co-authored-by: Tom <tomut@yahoo.com>
Diffstat (limited to 'Kernel/Arch/x86/i386')
-rw-r--r--Kernel/Arch/x86/i386/Processor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Arch/x86/i386/Processor.cpp b/Kernel/Arch/x86/i386/Processor.cpp
index a3fec8a10c..a7b38e0c54 100644
--- a/Kernel/Arch/x86/i386/Processor.cpp
+++ b/Kernel/Arch/x86/i386/Processor.cpp
@@ -185,6 +185,8 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread)
VERIFY(is_kernel_mode());
dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context --> switching out of: {} {}", VirtualAddress(from_thread), *from_thread);
+
+ // m_in_critical is restored in enter_thread_context
from_thread->save_critical(m_in_critical);
// clang-format off
@@ -230,8 +232,6 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread)
// clang-format on
dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread);
-
- Processor::current().restore_in_critical(to_thread->saved_critical());
}
UNMAP_AFTER_INIT void Processor::initialize_context_switching(Thread& initial_thread)