mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
Kernel: Replace calls to UART::print_str() with dbgln()
Since we can now use dbgln() in the aarch64 Kernel, lets use it! :^)
This commit is contained in:
parent
b046c82f75
commit
83265b4cb2
3 changed files with 36 additions and 77 deletions
|
@ -7,6 +7,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
|
||||
|
@ -17,7 +18,6 @@
|
|||
#include <Kernel/Arch/aarch64/RPi/Mailbox.h>
|
||||
#include <Kernel/Arch/aarch64/RPi/Timer.h>
|
||||
#include <Kernel/Arch/aarch64/RPi/UART.h>
|
||||
#include <Kernel/Arch/aarch64/Utils.h>
|
||||
|
||||
static void draw_logo();
|
||||
static u32 query_firmware_version();
|
||||
|
@ -38,29 +38,25 @@ extern "C" void exception_common(TrapFrame const* const trap_frame);
|
|||
|
||||
extern "C" [[noreturn]] void init()
|
||||
{
|
||||
auto& uart = Prekernel::UART::the();
|
||||
|
||||
uart.print_str("\r\nWelcome to Serenity OS!\r\n");
|
||||
uart.print_str("Imagine this being your ideal operating system.\r\n");
|
||||
uart.print_str("Observed deviations from that ideal are shortcomings of your imagination.\r\n\r\n");
|
||||
dbgln("Welcome to Serenity OS!");
|
||||
dbgln("Imagine this being your ideal operating system.");
|
||||
dbgln("Observed deviations from that ideal are shortcomings of your imagination.");
|
||||
dbgln();
|
||||
|
||||
auto firmware_version = query_firmware_version();
|
||||
uart.print_str("Firmware version: ");
|
||||
uart.print_num(firmware_version);
|
||||
uart.print_str("\r\n");
|
||||
dbgln("Firmware version: {}", firmware_version);
|
||||
|
||||
uart.print_str("CPU started in: EL");
|
||||
uart.print_num(static_cast<u64>(Kernel::Aarch64::Asm::get_current_exception_level()));
|
||||
uart.print_str("\r\n");
|
||||
auto current_exception_level = static_cast<u64>(Kernel::Aarch64::Asm::get_current_exception_level());
|
||||
dbgln("CPU started in: EL{}", current_exception_level);
|
||||
|
||||
uart.print_str("Drop CPU to EL1\r\n");
|
||||
dbgln("Drop CPU to EL1");
|
||||
Prekernel::drop_to_exception_level_1();
|
||||
|
||||
// Load EL1 vector table
|
||||
extern uintptr_t vector_table_el1;
|
||||
el1_vector_table_install(&vector_table_el1);
|
||||
|
||||
uart.print_str("Initialize MMU\r\n");
|
||||
dbgln("Initialize MMU");
|
||||
Prekernel::init_prekernel_page_tables();
|
||||
|
||||
auto& framebuffer = Prekernel::Framebuffer::the();
|
||||
|
@ -68,7 +64,7 @@ extern "C" [[noreturn]] void init()
|
|||
draw_logo();
|
||||
}
|
||||
|
||||
uart.print_str("Enter loop\r\n");
|
||||
dbgln("Enter loop");
|
||||
|
||||
auto& timer = Prekernel::Timer::the();
|
||||
u64 start_musec = 0;
|
||||
|
@ -77,9 +73,7 @@ extern "C" [[noreturn]] void init()
|
|||
while ((now_musec = timer.microseconds_since_boot()) - start_musec < 1'000'000)
|
||||
;
|
||||
start_musec = now_musec;
|
||||
uart.print_str("Timer: ");
|
||||
uart.print_num(now_musec);
|
||||
uart.print_str("\r\n");
|
||||
dbgln("Timer: {}", now_musec);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,18 +89,8 @@ void __stack_chk_fail()
|
|||
|
||||
[[noreturn]] void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func)
|
||||
{
|
||||
auto& uart = Prekernel::UART::the();
|
||||
|
||||
uart.print_str("\r\n\r\nASSERTION FAILED: ");
|
||||
uart.print_str(msg);
|
||||
|
||||
uart.print_str("\r\n");
|
||||
uart.print_str(file);
|
||||
uart.print_str(":");
|
||||
uart.print_num(line);
|
||||
|
||||
uart.print_str(" in ");
|
||||
uart.print_str(func);
|
||||
critical_dmesgln("ASSERTION FAILED: {}", msg);
|
||||
critical_dmesgln("{}:{} in {}", file, line, func);
|
||||
|
||||
Prekernel::halt();
|
||||
}
|
||||
|
@ -116,33 +100,17 @@ extern "C" void exception_common(TrapFrame const* const trap_frame)
|
|||
constexpr bool print_stack_frame = true;
|
||||
|
||||
if constexpr (print_stack_frame) {
|
||||
auto& uart = Prekernel::UART::the();
|
||||
dbgln("Exception Generated by processor!");
|
||||
|
||||
uart.print_str("Exception Generated by processor!\n");
|
||||
for (auto reg = 0; reg < 31; reg++) {
|
||||
uart.print_str("x");
|
||||
uart.print_num(reg);
|
||||
uart.print_str(": ");
|
||||
uart.print_hex(trap_frame->x[reg]);
|
||||
uart.print_str("\r\n");
|
||||
dbgln("x{}: {:x}", reg, trap_frame->x[reg]);
|
||||
}
|
||||
|
||||
// Special registers
|
||||
uart.print_str("spsr_el1: ");
|
||||
uart.print_hex(trap_frame->spsr_el1);
|
||||
uart.print_str("\r\n");
|
||||
|
||||
uart.print_str("elr_el1: ");
|
||||
uart.print_hex(trap_frame->elr_el1);
|
||||
uart.print_str("\r\n");
|
||||
|
||||
uart.print_str("tpidr_el1: ");
|
||||
uart.print_hex(trap_frame->tpidr_el1);
|
||||
uart.print_str("\r\n");
|
||||
|
||||
uart.print_str("sp_el0: ");
|
||||
uart.print_hex(trap_frame->sp_el0);
|
||||
uart.print_str("\r\n");
|
||||
dbgln("spsr_el1: {:x}", trap_frame->spsr_el1);
|
||||
dbgln("elr_el1: {:x}", trap_frame->elr_el1);
|
||||
dbgln("tpidr_el1: {:x}", trap_frame->tpidr_el1);
|
||||
dbgln("sp_el0: {:x}", trap_frame->sp_el0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,20 +147,11 @@ static void draw_logo()
|
|||
{
|
||||
Prekernel::BootPPMParser logo_parser(reinterpret_cast<u8 const*>(&serenity_boot_logo_start), serenity_boot_logo_size);
|
||||
if (!logo_parser.parse()) {
|
||||
Prekernel::warnln("Invalid boot logo.");
|
||||
dbgln("Failed to parse boot logo.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto& uart = Prekernel::UART::the();
|
||||
uart.print_str("Boot logo size: ");
|
||||
uart.print_num(serenity_boot_logo_size);
|
||||
uart.print_str("\r\n");
|
||||
uart.print_str("Width: ");
|
||||
uart.print_num(logo_parser.image.width);
|
||||
uart.print_str("\r\n");
|
||||
uart.print_str("Height: ");
|
||||
uart.print_num(logo_parser.image.height);
|
||||
uart.print_str("\r\n");
|
||||
dbgln("Boot logo size: {} ({} x {})", serenity_boot_logo_size, logo_parser.image.width, logo_parser.image.height);
|
||||
|
||||
auto& framebuffer = Prekernel::Framebuffer::the();
|
||||
auto fb_ptr = framebuffer.gpu_buffer();
|
||||
|
@ -217,8 +176,8 @@ static void draw_logo()
|
|||
fb_ptr[2] = logo_pixels[0];
|
||||
break;
|
||||
default:
|
||||
Prekernel::warnln("Unsupported pixel format");
|
||||
Prekernel::halt();
|
||||
dbgln("Unsupported pixel format");
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
logo_pixels += 3;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue