diff options
author | Liav A <liavalb@gmail.com> | 2022-09-02 15:59:21 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-20 18:43:05 +0100 |
commit | 5576151e6864bc0b3122c660d3234f30c83fc6bc (patch) | |
tree | 5b016d971aa9fa27054d8bd3c1a9c677e4daf80c | |
parent | fdef8d0d373524228ba21b8bdea7ea1aa2d1d53c (diff) | |
download | serenity-5576151e6864bc0b3122c660d3234f30c83fc6bc.zip |
Kernel: Don't blindly compile Bochs debug output code in ConsoleDevice
Only use the Bochs debug output if we compile a x86 build since bochs
debug output relies on x86 specific instructions.
We also remove the CONSOLE_OUT_TO_BOCHS_DEBUG_PORT flag as we always
compile bochs debug output for x86 builds and we always want to include
the bochs debug output capability as it is very handy and doesn't hurt
bare metal hardware or do any other problem besides taking a small
amount of CPU cycles.
-rw-r--r-- | Kernel/Devices/ConsoleDevice.cpp | 12 | ||||
-rw-r--r-- | Kernel/kprintf.cpp | 5 | ||||
-rw-r--r-- | Kernel/kstdio.h | 1 |
3 files changed, 11 insertions, 7 deletions
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 <Kernel/Arch/x86/IO.h> +#include <AK/Platform.h> +#if ARCH(I386) || ARCH(X86_64) +# include <Kernel/Arch/x86/common/BochsDebugOutput.h> +#endif #include <Kernel/Devices/ConsoleDevice.h> #include <Kernel/Devices/DeviceManagement.h> #include <Kernel/Locking/Spinlock.h> #include <Kernel/Sections.h> #include <Kernel/kstdio.h> -// 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> ConsoleDevice::must_create() @@ -57,8 +57,6 @@ ErrorOr<size_t> 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); |