1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Kernel: Use InterruptsState in Spinlock code

This commit updates the lock function from Spinlock and
RecursiveSpinlock to return the InterruptsState of the processor,
instead of the processor flags. The unlock functions would only look at
the interrupt flag of the processor flags, so we now use the
InterruptsState enum to clarify the intent, and such that we can use the
same Spinlock code for the aarch64 build.

To not break the build, all the call sites are updated aswell.
This commit is contained in:
Timon Kruiper 2022-08-23 21:42:30 +02:00 committed by Andreas Kling
parent 6432f3eee8
commit e8aff0c1c8
12 changed files with 41 additions and 51 deletions

View file

@ -327,13 +327,13 @@ void Scheduler::enter_current(Thread& prev_thread)
}
}
void Scheduler::leave_on_first_switch(u32 flags)
void Scheduler::leave_on_first_switch(InterruptsState previous_interrupts_state)
{
// This is called when a thread is switched into for the first time.
// At this point, enter_current has already be called, but because
// Scheduler::context_switch is not in the call stack we need to
// clean up and release locks manually here
g_scheduler_lock.unlock(flags);
g_scheduler_lock.unlock(previous_interrupts_state);
VERIFY(Processor::current_in_scheduler());
Processor::set_current_in_scheduler(false);