mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 04:07:35 +00:00
Kernel: Convert Processor::in_irq() to static current_in_irq()
This closes the race window between Processor::current() and a context switch happening before in_irq().
This commit is contained in:
parent
3e3f760808
commit
d60635cb9d
14 changed files with 37 additions and 39 deletions
|
@ -17,7 +17,7 @@ void Mutex::lock(Mode mode, [[maybe_unused]] LockLocation const& location)
|
|||
{
|
||||
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
|
||||
// and also from within critical sections!
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current_in_irq());
|
||||
VERIFY(mode != Mode::Unlocked);
|
||||
auto current_thread = Thread::current();
|
||||
|
||||
|
@ -143,7 +143,7 @@ void Mutex::unlock()
|
|||
{
|
||||
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
|
||||
// and also from within critical sections!
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current_in_irq());
|
||||
auto current_thread = Thread::current();
|
||||
SpinlockLocker lock(m_lock);
|
||||
Mode current_mode = m_mode;
|
||||
|
@ -253,7 +253,7 @@ auto Mutex::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode
|
|||
{
|
||||
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
|
||||
// and also from within critical sections!
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current_in_irq());
|
||||
auto current_thread = Thread::current();
|
||||
SpinlockLocker lock(m_lock);
|
||||
auto current_mode = m_mode;
|
||||
|
@ -316,7 +316,7 @@ void Mutex::restore_lock(Mode mode, u32 lock_count, [[maybe_unused]] LockLocatio
|
|||
{
|
||||
VERIFY(mode != Mode::Unlocked);
|
||||
VERIFY(lock_count > 0);
|
||||
VERIFY(!Processor::current().in_irq());
|
||||
VERIFY(!Processor::current_in_irq());
|
||||
auto current_thread = Thread::current();
|
||||
bool did_block = false;
|
||||
SpinlockLocker lock(m_lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue