diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2022-04-09 15:30:34 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-09 15:55:20 +0200 |
commit | 14fc05e912c8da8182cdded850469524db7740f4 (patch) | |
tree | f2889040e8ce36c859528c1b8fe99b05af8b4964 /Kernel/Locking | |
parent | bb02e9a7b944d4b2f254a18b4eb9a24973dae0cc (diff) | |
download | serenity-14fc05e912c8da8182cdded850469524db7740f4.zip |
Kernel: Verify mutex big lock behavior
These two methods are big lock specific, so verify our mutex' behavior.
Diffstat (limited to 'Kernel/Locking')
-rw-r--r-- | Kernel/Locking/Mutex.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Kernel/Locking/Mutex.cpp b/Kernel/Locking/Mutex.cpp index 45af124635..849fd6e25e 100644 --- a/Kernel/Locking/Mutex.cpp +++ b/Kernel/Locking/Mutex.cpp @@ -282,9 +282,11 @@ void Mutex::unblock_waiters(Mode previous_mode) auto Mutex::force_unlock_exclusive_if_locked(u32& lock_count_to_restore) -> Mode { + VERIFY(m_behavior == MutexBehavior::BigLock); // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! VERIFY(!Processor::current_in_irq()); + auto* current_thread = Thread::current(); SpinlockLocker lock(m_lock); auto current_mode = m_mode; @@ -319,8 +321,10 @@ auto Mutex::force_unlock_exclusive_if_locked(u32& lock_count_to_restore) -> Mode void Mutex::restore_exclusive_lock(u32 lock_count, [[maybe_unused]] LockLocation const& location) { + VERIFY(m_behavior == MutexBehavior::BigLock); VERIFY(lock_count > 0); VERIFY(!Processor::current_in_irq()); + auto* current_thread = Thread::current(); bool did_block = false; SpinlockLocker lock(m_lock); |