aboutsummaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-12 18:57:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-12 23:29:30 +0200
commit18c0d15c5b63fc2345c63a78f5586ff47eda706f (patch)
treeaf58a58053746a84048bfeba5acef6583e16c118 /kern
parent98a5b2d84e39d5cc8a92951589aa307fdbaff902 (diff)
downloadgnumach-18c0d15c5b63fc2345c63a78f5586ff47eda706f.tar.gz
gnumach-18c0d15c5b63fc2345c63a78f5586ff47eda706f.tar.bz2
gnumach-18c0d15c5b63fc2345c63a78f5586ff47eda706f.zip
simple lock: check that the non-_irq variants are not called from IRQ
Diffstat (limited to 'kern')
-rw-r--r--kern/lock.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/kern/lock.h b/kern/lock.h
index 2d493f87..885b60ba 100644
--- a/kern/lock.h
+++ b/kern/lock.h
@@ -49,6 +49,13 @@
* spl_t s = simple_lock_irq(&mylock);
* [... critical section]
* simple_unlock_irq(s, &mylock);
+ *
+ * To catch faulty code, when MACH_LDEBUG is set we check that non-_irq versions
+ * are not called while handling an interrupt.
+ *
+ * In the following, the _nocheck versions don't check anything, the _irq
+ * versions disable interrupts, and the pristine versions add a check when
+ * MACH_LDEBUG is set.
*/
#if NCPUS > 1
@@ -249,9 +256,8 @@ extern void lock_clear_recursive(lock_t);
/* XXX: We don't keep track of readers, so this is an approximation. */
#define have_read_lock(l) ((l)->read_count > 0)
#define have_write_lock(l) ((l)->writer == current_thread())
-// Disabled for now, until all places are fixed
extern unsigned long in_interrupt[NCPUS];
-#define lock_check_no_interrupts() // assert(!in_interrupt[cpu_number()])
+#define lock_check_no_interrupts() assert(!in_interrupt[cpu_number()])
#endif /* MACH_LDEBUG */
#define have_lock(l) (have_read_lock(l) || have_write_lock(l))