1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 14:07:29 +00:00

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.
This commit is contained in:
Liav A 2022-09-02 15:59:21 +03:00 committed by Linus Groh
parent fdef8d0d37
commit 5576151e68
3 changed files with 11 additions and 7 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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);