diff --git a/Kernel/Devices/ConsoleDevice.cpp b/Kernel/Devices/ConsoleDevice.cpp index 5e59705a45..4c3644a6eb 100644 --- a/Kernel/Devices/ConsoleDevice.cpp +++ b/Kernel/Devices/ConsoleDevice.cpp @@ -4,16 +4,16 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include +#if ARCH(I386) || ARCH(X86_64) +# include +#endif #include #include #include #include #include -// Output bytes to kernel debug port 0xE9 (Bochs console). It's very handy. -#define CONSOLE_OUT_TO_BOCHS_DEBUG_PORT - static Kernel::Spinlock g_console_lock { LockRank::None }; UNMAP_AFTER_INIT NonnullLockRefPtr ConsoleDevice::must_create() @@ -57,8 +57,6 @@ ErrorOr ConsoleDevice::write(OpenFileDescription&, u64, Kernel::UserOrKe void ConsoleDevice::put_char(char ch) { Kernel::SpinlockLocker lock(g_console_lock); -#ifdef CONSOLE_OUT_TO_BOCHS_DEBUG_PORT - IO::out8(IO::BOCHS_DEBUG_PORT, ch); -#endif + dbgputchar(ch); m_logbuffer.enqueue(ch); } diff --git a/Kernel/kprintf.cpp b/Kernel/kprintf.cpp index e244a2d80f..ecaa7bb1b7 100644 --- a/Kernel/kprintf.cpp +++ b/Kernel/kprintf.cpp @@ -144,6 +144,11 @@ static inline void internal_dbgputch(char ch) #endif } +extern "C" void dbgputchar(char ch) +{ + internal_dbgputch(ch); +} + extern "C" void dbgputstr(char const* characters, size_t length) { if (!characters) diff --git a/Kernel/kstdio.h b/Kernel/kstdio.h index 1006e607b8..be755c1698 100644 --- a/Kernel/kstdio.h +++ b/Kernel/kstdio.h @@ -13,6 +13,7 @@ extern "C" { void dbgputstr(char const*, size_t); void kernelputstr(char const*, size_t); void kernelcriticalputstr(char const*, size_t); +void dbgputchar(char); void kernelearlyputstr(char const*, size_t); int snprintf(char* buf, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4))); void set_serial_debug_enabled(bool desired_state);