From a308b176cef0dd109a1a0e7b8e0e2f546dc8321e Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 2 Jul 2020 08:34:14 -0600 Subject: [PATCH] Kernel: Allow recursion when writing to the debug log This allows printing in the case e.g. a page fault happens during a log statement --- Kernel/kprintf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kernel/kprintf.cpp b/Kernel/kprintf.cpp index ea386054f2..743232e939 100644 --- a/Kernel/kprintf.cpp +++ b/Kernel/kprintf.cpp @@ -35,7 +35,9 @@ #include static bool serial_debug; -static SpinLock s_log_lock; +// A recursive spinlock allows us to keep writing in the case where a +// page fault happens in the middle of a dbg(), klog(), etc +static RecursiveSpinLock s_log_lock; void set_serial_debug(bool on_or_off) {