1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:47:34 +00:00

Kernel: Protect Console with SpinLock

This commit is contained in:
Tom 2020-06-28 16:04:14 -06:00 committed by Andreas Kling
parent 16783bd14d
commit d249b5df8f

View file

@ -27,11 +27,13 @@
#include <Kernel/Console.h> #include <Kernel/Console.h>
#include <Kernel/IO.h> #include <Kernel/IO.h>
#include <Kernel/kstdio.h> #include <Kernel/kstdio.h>
#include <Kernel/SpinLock.h>
// Bytes output to 0xE9 end up on the Bochs console. It's very handy. // Bytes output to 0xE9 end up on the Bochs console. It's very handy.
#define CONSOLE_OUT_TO_E9 #define CONSOLE_OUT_TO_E9
static Console* s_the; static Console* s_the;
static Kernel::SpinLock g_console_lock;
Console& Console::the() 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) void Console::put_char(char ch)
{ {
Kernel::ScopedSpinLock lock(g_console_lock);
#ifdef CONSOLE_OUT_TO_E9 #ifdef CONSOLE_OUT_TO_E9
//if (ch != 27) //if (ch != 27)
IO::out8(0xe9, ch); IO::out8(0xe9, ch);