diff options
author | Timon Kruiper <timonkruiper@gmail.com> | 2022-05-02 19:39:22 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-03 00:59:35 +0200 |
commit | 83265b4cb2ed34cb1c4e14d983075480ca638f96 (patch) | |
tree | 437eb0d8f68e219d6d5922290ec9d05b1cf3f97e /Kernel | |
parent | b046c82f7529e2bcec18ea9a112d7ecbcf009c41 (diff) | |
download | serenity-83265b4cb2ed34cb1c4e14d983075480ca638f96.zip |
Kernel: Replace calls to UART::print_str() with dbgln()
Since we can now use dbgln() in the aarch64 Kernel, lets use it! :^)
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Arch/aarch64/RPi/Framebuffer.cpp | 20 | ||||
-rw-r--r-- | Kernel/Arch/aarch64/RPi/Timer.cpp | 4 | ||||
-rw-r--r-- | Kernel/Arch/aarch64/init.cpp | 89 |
3 files changed, 36 insertions, 77 deletions
diff --git a/Kernel/Arch/aarch64/RPi/Framebuffer.cpp b/Kernel/Arch/aarch64/RPi/Framebuffer.cpp index 7d46863002..38a9f3f80a 100644 --- a/Kernel/Arch/aarch64/RPi/Framebuffer.cpp +++ b/Kernel/Arch/aarch64/RPi/Framebuffer.cpp @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/Format.h> #include <Kernel/Arch/aarch64/RPi/Framebuffer.h> #include <Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h> -#include <Kernel/Arch/aarch64/Utils.h> namespace Prekernel { @@ -46,39 +46,39 @@ Framebuffer::Framebuffer() message_queue.allocate_buffer.alignment = 4096; if (!Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) { - warnln("Framebuffer(): Mailbox send failed."); + dbgln("Framebuffer(): Mailbox send failed."); return; } // Now message queue contains responses. Process them. if (message_queue.set_physical_size.width != m_width || message_queue.set_physical_size.height != m_height) { - warnln("Framebuffer(): Setting physical dimension failed."); + dbgln("Framebuffer(): Setting physical dimension failed."); return; } if (message_queue.set_virtual_size.width != m_width || message_queue.set_virtual_size.height != m_height) { - warnln("Framebuffer(): Setting virtual dimension failed."); + dbgln("Framebuffer(): Setting virtual dimension failed."); return; } if (message_queue.set_virtual_offset.x != 0 || message_queue.set_virtual_offset.y != 0) { - warnln("Framebuffer(): Setting virtual offset failed."); + dbgln("Framebuffer(): Setting virtual offset failed."); return; } if (message_queue.set_depth.depth_bits != m_depth) { - warnln("Framebuffer(): Setting depth failed."); + dbgln("Framebuffer(): Setting depth failed."); return; } if (message_queue.allocate_buffer.size == 0 || message_queue.allocate_buffer.address == 0) { - warnln("Framebuffer(): Allocating buffer failed."); + dbgln("Framebuffer(): Allocating buffer failed."); return; } if (message_queue.get_pitch.pitch == 0) { - warnln("Framebuffer(): Retrieving pitch failed."); + dbgln("Framebuffer(): Retrieving pitch failed."); return; } @@ -97,12 +97,12 @@ Framebuffer::Framebuffer() m_pixel_order = PixelOrder::BGR; break; default: - warnln("Framebuffer(): Unsupported pixel order reported by GPU."); + dbgln("Framebuffer(): Unsupported pixel order reported by GPU."); m_pixel_order = PixelOrder::RGB; break; } - dbgln("Initialized framebuffer: 1280 x 720 @ 32 bits"); + dbgln("Initialized framebuffer: {} x {} @ {} bits", m_width, m_height, m_depth); m_initialized = true; } diff --git a/Kernel/Arch/aarch64/RPi/Timer.cpp b/Kernel/Arch/aarch64/RPi/Timer.cpp index bbfd6873d5..6ea4ce03bd 100644 --- a/Kernel/Arch/aarch64/RPi/Timer.cpp +++ b/Kernel/Arch/aarch64/RPi/Timer.cpp @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/Format.h> #include <Kernel/Arch/aarch64/RPi/MMIO.h> #include <Kernel/Arch/aarch64/RPi/Mailbox.h> #include <Kernel/Arch/aarch64/RPi/Timer.h> -#include <Kernel/Arch/aarch64/Utils.h> namespace Prekernel { @@ -78,7 +78,7 @@ u32 Timer::set_clock_rate(ClockID clock_id, u32 rate_hz, bool skip_setting_turbo message_queue.set_clock_rate.skip_setting_turbo = skip_setting_turbo ? 1 : 0; if (!Prekernel::Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) { - warnln("Timer::set_clock_rate() failed!"); + dbgln("Timer::set_clock_rate() failed!"); return 0; } diff --git a/Kernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp index ad5d6fc811..fc8693e417 100644 --- a/Kernel/Arch/aarch64/init.cpp +++ b/Kernel/Arch/aarch64/init.cpp @@ -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; |