summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-06-28 16:04:14 -0600
committerAndreas Kling <kling@serenityos.org>2020-07-01 12:07:01 +0200
commitd249b5df8f03949040f5a4ddfe5b2f7b9b4b1740 (patch)
tree5ba0388bf4f04ca67e13e59905fb12339027abcd /Kernel
parent16783bd14d5284542205a50c441562c19174f101 (diff)
downloadserenity-d249b5df8f03949040f5a4ddfe5b2f7b9b4b1740.zip
Kernel: Protect Console with SpinLock
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Console.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Console.cpp b/Kernel/Console.cpp
index 9f91261961..cf38867cf0 100644
--- a/Kernel/Console.cpp
+++ b/Kernel/Console.cpp
@@ -27,11 +27,13 @@
#include <Kernel/Console.h>
#include <Kernel/IO.h>
#include <Kernel/kstdio.h>
+#include <Kernel/SpinLock.h>
// Bytes output to 0xE9 end up on the Bochs console. It's very handy.
#define CONSOLE_OUT_TO_E9
static Console* s_the;
+static Kernel::SpinLock g_console_lock;
Console& Console::the()
{
@@ -77,6 +79,7 @@ ssize_t Console::write(Kernel::FileDescription&, size_t, const u8* data, ssize_t
void Console::put_char(char ch)
{
+ Kernel::ScopedSpinLock lock(g_console_lock);
#ifdef CONSOLE_OUT_TO_E9
//if (ch != 27)
IO::out8(0xe9, ch);