summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-08-06 14:36:55 +0300
committerAndreas Kling <kling@serenityos.org>2021-08-06 23:36:12 +0200
commit72331168beace30cfa5c560cec25298228e2f1ca (patch)
tree3256f5899f52b4dfc501560e9dcc09a32d9cec03 /Kernel
parentc7ad4c6c322c58660f0eccb0459c1b6367c23223 (diff)
downloadserenity-72331168beace30cfa5c560cec25298228e2f1ca.zip
Kernel: Hold the global logging lock in dbgputch
This was not an active issue as sys$dbgputch (the only user of this function) is not actually used anywhere.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/kprintf.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Kernel/kprintf.cpp b/Kernel/kprintf.cpp
index 4f22b270dc..253c55b2f3 100644
--- a/Kernel/kprintf.cpp
+++ b/Kernel/kprintf.cpp
@@ -143,20 +143,26 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...)
return ret;
}
-extern "C" void dbgputch(char ch)
+static inline void internal_dbgputch(char ch)
{
if (serial_debug)
serial_putch(ch);
IO::out8(IO::BOCHS_DEBUG_PORT, ch);
}
+extern "C" void dbgputch(char ch)
+{
+ ScopedSpinLock lock(s_log_lock);
+ internal_dbgputch(ch);
+}
+
extern "C" void dbgputstr(const char* characters, size_t length)
{
if (!characters)
return;
ScopedSpinLock lock(s_log_lock);
for (size_t i = 0; i < length; ++i)
- dbgputch(characters[i]);
+ internal_dbgputch(characters[i]);
}
extern "C" void kernelputstr(const char* characters, size_t length)