summaryrefslogtreecommitdiff
path: root/Kernel/Devices/ConsoleDevice.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-09-02 15:59:21 +0300
committerLinus Groh <mail@linusgroh.de>2022-09-20 18:43:05 +0100
commit5576151e6864bc0b3122c660d3234f30c83fc6bc (patch)
tree5b016d971aa9fa27054d8bd3c1a9c677e4daf80c /Kernel/Devices/ConsoleDevice.cpp
parentfdef8d0d373524228ba21b8bdea7ea1aa2d1d53c (diff)
downloadserenity-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.
Diffstat (limited to 'Kernel/Devices/ConsoleDevice.cpp')
-rw-r--r--Kernel/Devices/ConsoleDevice.cpp12
1 files changed, 5 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);
}