diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-22 12:21:31 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-23 00:02:09 +0200 |
commit | d60635cb9df9b4e72702db02b88b26ab9123c2a8 (patch) | |
tree | 162105dee63773b68678c54d5a7f4016f7574c8f /Kernel/Locking/Mutex.cpp | |
parent | 3e3f760808e614ca70d97294013cb58f2a0deaf5 (diff) | |
download | serenity-d60635cb9df9b4e72702db02b88b26ab9123c2a8.zip |
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().
Diffstat (limited to 'Kernel/Locking/Mutex.cpp')
-rw-r--r-- | Kernel/Locking/Mutex.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Locking/Mutex.cpp b/Kernel/Locking/Mutex.cpp index b7271fbf07..829001958b 100644 --- a/Kernel/Locking/Mutex.cpp +++ b/Kernel/Locking/Mutex.cpp @@ -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); |