mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
Kernel/x86: Disable interrupts when leaving critical sections
This fixes an issue where we could get preempted after acquiring the current Processor pointer, but before calling methods on it. I strongly suspect this was the cause of "Processor::current() == this" assertion failures.
This commit is contained in:
parent
cd348918f9
commit
51bc87d15a
1 changed files with 3 additions and 1 deletions
|
@ -990,7 +990,7 @@ void Processor::exit_trap(TrapFrame& trap)
|
|||
|
||||
void Processor::check_invoke_scheduler()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
VERIFY(!m_in_irq);
|
||||
VERIFY(!m_in_critical);
|
||||
VERIFY(&Processor::current() == this);
|
||||
|
@ -1667,6 +1667,7 @@ u64 Processor::time_spent_idle() const
|
|||
|
||||
void Processor::leave_critical()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
current().do_leave_critical();
|
||||
}
|
||||
|
||||
|
@ -1688,6 +1689,7 @@ void Processor::do_leave_critical()
|
|||
|
||||
u32 Processor::clear_critical()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
auto prev_critical = in_critical();
|
||||
write_gs_ptr(__builtin_offsetof(Processor, m_in_critical), 0);
|
||||
auto& proc = current();
|
||||
|
|
Loading…
Add table
Reference in a new issue