Kernel: Verify mutex big lock behavior

These two methods are big lock specific, so verify our mutex' behavior.
This commit is contained in:
Jelle Raaijmakers 2022-04-09 15:30:34 +02:00 committed by Andreas Kling
parent bb02e9a7b9
commit 14fc05e912
Notes: sideshowbarker 2024-07-17 14:14:37 +09:00

View file

@ -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);