hrev53046 adds 1 changeset to branch 'master'
old head: 0788d17ae2979809dee129fdaf8af95caac57d32
new head: 7a15c1cbc5e4cd58bc6d97943307b8df3fc20d69
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=7a15c1cbc5e4+%5E0788d17ae297
----------------------------------------------------------------------------
7a15c1cbc5e4: kernel: Add interrupts checks for switch_lock functions.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53046
Commit: 7a15c1cbc5e4cd58bc6d97943307b8df3fc20d69
URL: https://git.haiku-os.org/haiku/commit/?id=7a15c1cbc5e4
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Sat Apr 6 17:55:45 2019 UTC
----------------------------------------------------------------------------
1 file changed, 14 insertions(+)
src/system/kernel/locks/lock.cpp | 14 ++++++++++++++
----------------------------------------------------------------------------
diff --git a/src/system/kernel/locks/lock.cpp b/src/system/kernel/locks/lock.cpp
index 3ab0e49932..ab62a1ac49 100644
--- a/src/system/kernel/locks/lock.cpp
+++ b/src/system/kernel/locks/lock.cpp
@@ -676,6 +676,13 @@ mutex_lock_threads_locked(mutex* lock,
InterruptsSpinLocker* locker)
status_t
mutex_switch_lock(mutex* from, mutex* to)
{
+#if KDEBUG
+ if (!gKernelStartup && !are_interrupts_enabled()) {
+ panic("mutex_switch_lock(): called with interrupts disabled "
+ "for locks %p, %p", from, to);
+ }
+#endif
+
InterruptsSpinLocker locker(to->lock);
mutex_unlock(from);
@@ -687,6 +694,13 @@ mutex_switch_lock(mutex* from, mutex* to)
status_t
mutex_switch_from_read_lock(rw_lock* from, mutex* to)
{
+#if KDEBUG
+ if (!gKernelStartup && !are_interrupts_enabled()) {
+ panic("mutex_switch_from_read_lock(): called with interrupts
disabled "
+ "for locks %p, %p", from, to);
+ }
+#endif
+
InterruptsSpinLocker locker(to->lock);
#if KDEBUG_RW_LOCK_DEBUG