Skip to content

Commit

Permalink
Kernel: Protect Console with SpinLock
Browse files Browse the repository at this point in the history
  • Loading branch information
tomuta authored and awesomekling committed Jul 1, 2020
1 parent 16783bd commit d249b5d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Kernel/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d249b5d

Please sign in to comment.