From b9944ca9054e73885ec0e877e6b43c79106f9e55 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 2 May 2022 18:39:31 +0200 Subject: [PATCH] Kernel: Add aarch64 version of kprintf.cpp This allows us to use the AK formatting functions in the aarch64 Kernel. Also add FIXME to make sure that this file will be removed when the proper abstractions are in place in the normal Kernel/kprintf.cpp. --- Kernel/Arch/aarch64/Dummy.cpp | 19 ----------------- Kernel/Arch/aarch64/kprintf.cpp | 37 +++++++++++++++++++++++++++++++++ Kernel/CMakeLists.txt | 1 + 3 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 Kernel/Arch/aarch64/kprintf.cpp diff --git a/Kernel/Arch/aarch64/Dummy.cpp b/Kernel/Arch/aarch64/Dummy.cpp index 2afb223818..e9807e6843 100644 --- a/Kernel/Arch/aarch64/Dummy.cpp +++ b/Kernel/Arch/aarch64/Dummy.cpp @@ -212,24 +212,5 @@ bool safe_atomic_store_relaxed(u32 volatile*, u32) } extern "C" { - FlatPtr kernel_mapping_base; - -void kernelputstr(char const*, size_t); -void kernelputstr(char const*, size_t) -{ - VERIFY_NOT_REACHED(); -} - -void kernelcriticalputstr(char const*, size_t); -void kernelcriticalputstr(char const*, size_t) -{ - VERIFY_NOT_REACHED(); -} - -void kernelearlyputstr(char const*, size_t); -void kernelearlyputstr(char const*, size_t) -{ - VERIFY_NOT_REACHED(); -} } diff --git a/Kernel/Arch/aarch64/kprintf.cpp b/Kernel/Arch/aarch64/kprintf.cpp new file mode 100644 index 0000000000..7c20d34e4a --- /dev/null +++ b/Kernel/Arch/aarch64/kprintf.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022, Timon Kruiper + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +// FIXME: Merge the code in this file with Kernel/kprintf.cpp once the proper abstractions are in place. + +void kernelputstr(char const* characters, size_t) +{ + if (!characters) + return; + + auto& uart = Prekernel::UART::the(); + uart.print_str(characters); +} + +void kernelcriticalputstr(char const* characters, size_t) +{ + if (!characters) + return; + + auto& uart = Prekernel::UART::the(); + uart.print_str(characters); +} + +void kernelearlyputstr(char const* characters, size_t) +{ + if (!characters) + return; + + auto& uart = Prekernel::UART::the(); + uart.print_str(characters); +} diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index d6961852c2..d0a3ae538b 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -415,6 +415,7 @@ else() Arch/aarch64/BootPPMParser.cpp Arch/aarch64/CrashHandler.cpp Arch/aarch64/Dummy.cpp + Arch/aarch64/kprintf.cpp Arch/aarch64/MainIdRegister.cpp Arch/aarch64/PageDirectory.cpp Arch/aarch64/ScopedCritical.cpp