diff options
Diffstat (limited to 'Kernel')
23 files changed, 55 insertions, 57 deletions
diff --git a/Kernel/Arch/aarch64/BootPPMParser.cpp b/Kernel/Arch/aarch64/BootPPMParser.cpp index 6061e1c427..b8fe4f2540 100644 --- a/Kernel/Arch/aarch64/BootPPMParser.cpp +++ b/Kernel/Arch/aarch64/BootPPMParser.cpp @@ -6,7 +6,7 @@ #include "BootPPMParser.h" -namespace Prekernel { +namespace Kernel { BootPPMParser::BootPPMParser(u8 const* buffer, u32 buffer_size) { diff --git a/Kernel/Arch/aarch64/BootPPMParser.h b/Kernel/Arch/aarch64/BootPPMParser.h index a311a50a7a..4c007964bc 100644 --- a/Kernel/Arch/aarch64/BootPPMParser.h +++ b/Kernel/Arch/aarch64/BootPPMParser.h @@ -8,7 +8,7 @@ #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { // Quick parser for .ppm image format (raw PortablePixMap) // This is much simpler version than userland implementation in PPMLoader.cpp diff --git a/Kernel/Arch/aarch64/CPU.h b/Kernel/Arch/aarch64/CPU.h index a71c4dd73b..5157ce023d 100644 --- a/Kernel/Arch/aarch64/CPU.h +++ b/Kernel/Arch/aarch64/CPU.h @@ -8,7 +8,7 @@ #define PAGE_MASK (~(FlatPtr)0xfffu) -namespace Prekernel { +namespace Kernel { void drop_to_exception_level_1(); void init_prekernel_page_tables(); diff --git a/Kernel/Arch/aarch64/Exceptions.cpp b/Kernel/Arch/aarch64/Exceptions.cpp index 8d47d59333..2e050571fc 100644 --- a/Kernel/Arch/aarch64/Exceptions.cpp +++ b/Kernel/Arch/aarch64/Exceptions.cpp @@ -9,9 +9,7 @@ #include <Kernel/Arch/aarch64/Registers.h> #include <Kernel/Panic.h> -using namespace Kernel; - -namespace Prekernel { +namespace Kernel { static void drop_to_el2() { @@ -80,14 +78,14 @@ static void set_up_el1() void drop_to_exception_level_1() { - switch (Kernel::Aarch64::Asm::get_current_exception_level()) { - case Kernel::Aarch64::Asm::ExceptionLevel::EL3: + switch (Aarch64::Asm::get_current_exception_level()) { + case Aarch64::Asm::ExceptionLevel::EL3: drop_to_el2(); [[fallthrough]]; - case Kernel::Aarch64::Asm::ExceptionLevel::EL2: + case Aarch64::Asm::ExceptionLevel::EL2: drop_to_el1(); [[fallthrough]]; - case Kernel::Aarch64::Asm::ExceptionLevel::EL1: + case Aarch64::Asm::ExceptionLevel::EL1: set_up_el1(); break; default: { diff --git a/Kernel/Arch/aarch64/MMU.cpp b/Kernel/Arch/aarch64/MMU.cpp index 26388d6cc1..43882a04bd 100644 --- a/Kernel/Arch/aarch64/MMU.cpp +++ b/Kernel/Arch/aarch64/MMU.cpp @@ -17,13 +17,11 @@ // Documentation here for Aarch64 Address Translations // https://documentation-service.arm.com/static/5efa1d23dbdee951c1ccdec5?token= -using namespace Kernel; - // These come from the linker script extern u8 page_tables_phys_start[]; extern u8 page_tables_phys_end[]; -namespace Prekernel { +namespace Kernel { // physical memory constexpr u32 START_OF_NORMAL_MEMORY = 0x00000000; diff --git a/Kernel/Arch/aarch64/MainIdRegister.cpp b/Kernel/Arch/aarch64/MainIdRegister.cpp index 9b363a72b9..0ffec21116 100644 --- a/Kernel/Arch/aarch64/MainIdRegister.cpp +++ b/Kernel/Arch/aarch64/MainIdRegister.cpp @@ -6,7 +6,7 @@ #include <Kernel/Arch/aarch64/MainIdRegister.h> -namespace Prekernel { +namespace Kernel { MainIdRegister::MainIdRegister() { diff --git a/Kernel/Arch/aarch64/MainIdRegister.h b/Kernel/Arch/aarch64/MainIdRegister.h index 5f8d775acb..1b53c269d0 100644 --- a/Kernel/Arch/aarch64/MainIdRegister.h +++ b/Kernel/Arch/aarch64/MainIdRegister.h @@ -6,7 +6,7 @@ #pragma once -namespace Prekernel { +namespace Kernel { class MainIdRegister { public: diff --git a/Kernel/Arch/aarch64/Processor.cpp b/Kernel/Arch/aarch64/Processor.cpp index 495de96aaa..e4252782a8 100644 --- a/Kernel/Arch/aarch64/Processor.cpp +++ b/Kernel/Arch/aarch64/Processor.cpp @@ -8,6 +8,7 @@ #include <Kernel/Arch/Processor.h> #include <Kernel/Arch/aarch64/ASM_wrapper.h> +#include <Kernel/Arch/aarch64/CPU.h> extern "C" uintptr_t vector_table_el1; @@ -19,14 +20,14 @@ void Processor::initialize(u32 cpu) { VERIFY(g_current_processor == nullptr); - auto current_exception_level = static_cast<u64>(Kernel::Aarch64::Asm::get_current_exception_level()); + auto current_exception_level = static_cast<u64>(Aarch64::Asm::get_current_exception_level()); dbgln("CPU{} started in: EL{}", cpu, current_exception_level); dbgln("Drop CPU{} to EL1", cpu); - Prekernel::drop_to_exception_level_1(); + drop_to_exception_level_1(); // Load EL1 vector table - Kernel::Aarch64::Asm::el1_vector_table_install(&vector_table_el1); + Aarch64::Asm::el1_vector_table_install(&vector_table_el1); g_current_processor = this; } diff --git a/Kernel/Arch/aarch64/RPi/Framebuffer.cpp b/Kernel/Arch/aarch64/RPi/Framebuffer.cpp index 38a9f3f80a..a7705e6d2a 100644 --- a/Kernel/Arch/aarch64/RPi/Framebuffer.cpp +++ b/Kernel/Arch/aarch64/RPi/Framebuffer.cpp @@ -8,7 +8,7 @@ #include <Kernel/Arch/aarch64/RPi/Framebuffer.h> #include <Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h> -namespace Prekernel { +namespace Kernel { Framebuffer::Framebuffer() { diff --git a/Kernel/Arch/aarch64/RPi/Framebuffer.h b/Kernel/Arch/aarch64/RPi/Framebuffer.h index 2cde37dfdb..e5ab9e2fc3 100644 --- a/Kernel/Arch/aarch64/RPi/Framebuffer.h +++ b/Kernel/Arch/aarch64/RPi/Framebuffer.h @@ -8,7 +8,7 @@ #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { class Framebuffer { public: diff --git a/Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h b/Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h index 028b3abecd..29f1a1de2a 100644 --- a/Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h +++ b/Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h @@ -8,7 +8,7 @@ #include <Kernel/Arch/aarch64/RPi/Mailbox.h> -namespace Prekernel { +namespace Kernel { class FramebufferSetPhysicalSizeMboxMessage : public Mailbox::Message { public: diff --git a/Kernel/Arch/aarch64/RPi/GPIO.cpp b/Kernel/Arch/aarch64/RPi/GPIO.cpp index 23b47e5898..0fea124f7f 100644 --- a/Kernel/Arch/aarch64/RPi/GPIO.cpp +++ b/Kernel/Arch/aarch64/RPi/GPIO.cpp @@ -8,7 +8,7 @@ #include <Kernel/Arch/aarch64/RPi/GPIO.h> #include <Kernel/Arch/aarch64/RPi/MMIO.h> -namespace Prekernel { +namespace Kernel { // See BCM2835-ARM-Peripherals.pdf section "6 General Purpose I/O" or bcm2711-peripherals.pdf "Chapter 5. General Purpose I/O". @@ -72,7 +72,7 @@ void GPIO::internal_enable_pins(u32 enable[2], PullUpDownState state) m_registers->pull_up_down_enable = static_cast<u32>(state); // 2. Wait 150 cycles – this provides the required set-up time for the control signal - Kernel::Aarch64::Asm::wait_cycles(150); + Aarch64::Asm::wait_cycles(150); // 3. Write to GPPUDCLK0/1 to clock the control signal into the GPIO pads you wish to // modify – NOTE only the pads which receive a clock will be modified, all others will @@ -81,7 +81,7 @@ void GPIO::internal_enable_pins(u32 enable[2], PullUpDownState state) m_registers->pull_up_down_enable_clock.bits[1] = enable[1]; // 4. Wait 150 cycles – this provides the required hold time for the control signal - Kernel::Aarch64::Asm::wait_cycles(150); + Aarch64::Asm::wait_cycles(150); // 5. Write to GPPUD to remove the control signal m_registers->pull_up_down_enable = 0; diff --git a/Kernel/Arch/aarch64/RPi/GPIO.h b/Kernel/Arch/aarch64/RPi/GPIO.h index 4f38f9c376..ee3e370826 100644 --- a/Kernel/Arch/aarch64/RPi/GPIO.h +++ b/Kernel/Arch/aarch64/RPi/GPIO.h @@ -9,7 +9,7 @@ #include <AK/Array.h> #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { struct GPIOControlRegisters; diff --git a/Kernel/Arch/aarch64/RPi/MMIO.cpp b/Kernel/Arch/aarch64/RPi/MMIO.cpp index 8f4dddd9c5..5a63b72f37 100644 --- a/Kernel/Arch/aarch64/RPi/MMIO.cpp +++ b/Kernel/Arch/aarch64/RPi/MMIO.cpp @@ -7,7 +7,7 @@ #include <Kernel/Arch/aarch64/MainIdRegister.h> #include <Kernel/Arch/aarch64/RPi/MMIO.h> -namespace Prekernel { +namespace Kernel { MMIO::MMIO() : m_base_address(0xFE00'0000) diff --git a/Kernel/Arch/aarch64/RPi/MMIO.h b/Kernel/Arch/aarch64/RPi/MMIO.h index 895319d869..1eafc3b4b6 100644 --- a/Kernel/Arch/aarch64/RPi/MMIO.h +++ b/Kernel/Arch/aarch64/RPi/MMIO.h @@ -8,7 +8,7 @@ #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { // Knows about memory-mapped IO addresses on the Broadcom family of SOCs used in Raspberry Pis. // RPi3 is the first Raspberry Pi that supports aarch64. diff --git a/Kernel/Arch/aarch64/RPi/Mailbox.cpp b/Kernel/Arch/aarch64/RPi/Mailbox.cpp index 53988b976f..e11723f245 100644 --- a/Kernel/Arch/aarch64/RPi/Mailbox.cpp +++ b/Kernel/Arch/aarch64/RPi/Mailbox.cpp @@ -7,7 +7,7 @@ #include <Kernel/Arch/aarch64/RPi/MMIO.h> #include <Kernel/Arch/aarch64/RPi/Mailbox.h> -namespace Prekernel { +namespace Kernel { // There's one mailbox at MBOX_BASE_OFFSET for reading responses from VideoCore, and one at MBOX_BASE_OFFSET + 0x20 for sending requests. // Each has its own status word. diff --git a/Kernel/Arch/aarch64/RPi/Mailbox.h b/Kernel/Arch/aarch64/RPi/Mailbox.h index f54eea7c99..042283e306 100644 --- a/Kernel/Arch/aarch64/RPi/Mailbox.h +++ b/Kernel/Arch/aarch64/RPi/Mailbox.h @@ -8,7 +8,7 @@ #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { // Can exchange mailbox messages with the Raspberry Pi's VideoCore chip. // https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface diff --git a/Kernel/Arch/aarch64/RPi/Timer.cpp b/Kernel/Arch/aarch64/RPi/Timer.cpp index 6ea4ce03bd..5b32f5d247 100644 --- a/Kernel/Arch/aarch64/RPi/Timer.cpp +++ b/Kernel/Arch/aarch64/RPi/Timer.cpp @@ -9,7 +9,7 @@ #include <Kernel/Arch/aarch64/RPi/Mailbox.h> #include <Kernel/Arch/aarch64/RPi/Timer.h> -namespace Prekernel { +namespace Kernel { // "12.1 System Timer Registers" / "10.2 System Timer Registers" struct TimerRegisters { @@ -50,14 +50,14 @@ u64 Timer::microseconds_since_boot() return (static_cast<u64>(high) << 32) | low; } -class SetClockRateMboxMessage : Prekernel::Mailbox::Message { +class SetClockRateMboxMessage : Mailbox::Message { public: u32 clock_id; u32 rate_hz; u32 skip_setting_turbo; SetClockRateMboxMessage() - : Prekernel::Mailbox::Message(0x0003'8002, 12) + : Mailbox::Message(0x0003'8002, 12) { clock_id = 0; rate_hz = 0; @@ -68,16 +68,16 @@ public: u32 Timer::set_clock_rate(ClockID clock_id, u32 rate_hz, bool skip_setting_turbo) { struct __attribute__((aligned(16))) { - Prekernel::Mailbox::MessageHeader header; + Mailbox::MessageHeader header; SetClockRateMboxMessage set_clock_rate; - Prekernel::Mailbox::MessageTail tail; + Mailbox::MessageTail tail; } message_queue; message_queue.set_clock_rate.clock_id = static_cast<u32>(clock_id); message_queue.set_clock_rate.rate_hz = rate_hz; message_queue.set_clock_rate.skip_setting_turbo = skip_setting_turbo ? 1 : 0; - if (!Prekernel::Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) { + if (!Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) { dbgln("Timer::set_clock_rate() failed!"); return 0; } diff --git a/Kernel/Arch/aarch64/RPi/Timer.h b/Kernel/Arch/aarch64/RPi/Timer.h index 27762930bf..eddda13eaf 100644 --- a/Kernel/Arch/aarch64/RPi/Timer.h +++ b/Kernel/Arch/aarch64/RPi/Timer.h @@ -8,7 +8,7 @@ #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { struct TimerRegisters; diff --git a/Kernel/Arch/aarch64/RPi/UART.cpp b/Kernel/Arch/aarch64/RPi/UART.cpp index 8606a20031..b1134fcfd9 100644 --- a/Kernel/Arch/aarch64/RPi/UART.cpp +++ b/Kernel/Arch/aarch64/RPi/UART.cpp @@ -9,7 +9,7 @@ #include <Kernel/Arch/aarch64/RPi/Timer.h> #include <Kernel/Arch/aarch64/RPi/UART.h> -namespace Prekernel { +namespace Kernel { // "13.4 Register View" / "11.5 Register View" struct UARTRegisters { @@ -104,10 +104,10 @@ UART::UART() u32 rate_in_hz = Timer::the().set_clock_rate(Timer::ClockID::UART, 16 * baud_rate); // The BCM's PL011 UART is alternate function 0 on pins 14 and 15. - auto& gpio = Prekernel::GPIO::the(); - gpio.set_pin_function(14, Prekernel::GPIO::PinFunction::Alternate0); - gpio.set_pin_function(15, Prekernel::GPIO::PinFunction::Alternate0); - gpio.set_pin_pull_up_down_state(Array { 14, 15 }, Prekernel::GPIO::PullUpDownState::Disable); + auto& gpio = GPIO::the(); + gpio.set_pin_function(14, GPIO::PinFunction::Alternate0); + gpio.set_pin_function(15, GPIO::PinFunction::Alternate0); + gpio.set_pin_pull_up_down_state(Array { 14, 15 }, GPIO::PullUpDownState::Disable); // Clock and pins are configured. Turn UART on. set_baud_rate(baud_rate, rate_in_hz); diff --git a/Kernel/Arch/aarch64/RPi/UART.h b/Kernel/Arch/aarch64/RPi/UART.h index 037f0a31fe..753521205a 100644 --- a/Kernel/Arch/aarch64/RPi/UART.h +++ b/Kernel/Arch/aarch64/RPi/UART.h @@ -9,7 +9,7 @@ #include <AK/Types.h> -namespace Prekernel { +namespace Kernel { struct UARTRegisters; diff --git a/Kernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp index b20a9f98d9..c9b64ba5e4 100644 --- a/Kernel/Arch/aarch64/init.cpp +++ b/Kernel/Arch/aarch64/init.cpp @@ -12,6 +12,7 @@ #include <Kernel/Arch/Processor.h> #include <Kernel/Arch/aarch64/BootPPMParser.h> +#include <Kernel/Arch/aarch64/CPU.h> #include <Kernel/Arch/aarch64/RPi/Framebuffer.h> #include <Kernel/Arch/aarch64/RPi/Mailbox.h> #include <Kernel/Arch/aarch64/RPi/Timer.h> @@ -72,16 +73,16 @@ extern "C" [[noreturn]] void init() dbgln("Firmware version: {}", firmware_version); dbgln("Initialize MMU"); - Prekernel::init_prekernel_page_tables(); + Kernel::init_prekernel_page_tables(); - auto& framebuffer = Prekernel::Framebuffer::the(); + auto& framebuffer = Kernel::Framebuffer::the(); if (framebuffer.initialized()) { draw_logo(); } dbgln("Enter loop"); - auto& timer = Prekernel::Timer::the(); + auto& timer = Kernel::Timer::the(); u64 start_musec = 0; for (;;) { u64 now_musec; @@ -132,12 +133,12 @@ extern "C" void exception_common(TrapFrame const* const trap_frame) } } -class QueryFirmwareVersionMboxMessage : Prekernel::Mailbox::Message { +class QueryFirmwareVersionMboxMessage : Kernel::Mailbox::Message { public: u32 version; QueryFirmwareVersionMboxMessage() - : Prekernel::Mailbox::Message(0x0000'0001, 4) + : Kernel::Mailbox::Message(0x0000'0001, 4) { version = 0; } @@ -146,12 +147,12 @@ public: static u32 query_firmware_version() { struct __attribute__((aligned(16))) { - Prekernel::Mailbox::MessageHeader header; + Kernel::Mailbox::MessageHeader header; QueryFirmwareVersionMboxMessage query_firmware_version; - Prekernel::Mailbox::MessageTail tail; + Kernel::Mailbox::MessageTail tail; } message_queue; - if (!Prekernel::Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) { + if (!Kernel::Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) { return 0xffff'ffff; } @@ -163,7 +164,7 @@ extern "C" const u32 serenity_boot_logo_size; static void draw_logo() { - Prekernel::BootPPMParser logo_parser(reinterpret_cast<u8 const*>(&serenity_boot_logo_start), serenity_boot_logo_size); + Kernel::BootPPMParser logo_parser(reinterpret_cast<u8 const*>(&serenity_boot_logo_start), serenity_boot_logo_size); if (!logo_parser.parse()) { dbgln("Failed to parse boot logo."); return; @@ -171,7 +172,7 @@ static void draw_logo() dbgln("Boot logo size: {} ({} x {})", serenity_boot_logo_size, logo_parser.image.width, logo_parser.image.height); - auto& framebuffer = Prekernel::Framebuffer::the(); + auto& framebuffer = Kernel::Framebuffer::the(); auto fb_ptr = framebuffer.gpu_buffer(); auto image_left = (framebuffer.width() - logo_parser.image.width) / 2; auto image_right = image_left + logo_parser.image.width; @@ -183,12 +184,12 @@ static void draw_logo() for (u32 x = 0; x < framebuffer.width(); x++) { if (x >= image_left && x < image_right && y >= image_top && y < image_bottom) { switch (framebuffer.pixel_order()) { - case Prekernel::Framebuffer::PixelOrder::RGB: + case Kernel::Framebuffer::PixelOrder::RGB: fb_ptr[0] = logo_pixels[0]; fb_ptr[1] = logo_pixels[1]; fb_ptr[2] = logo_pixels[2]; break; - case Prekernel::Framebuffer::PixelOrder::BGR: + case Kernel::Framebuffer::PixelOrder::BGR: fb_ptr[0] = logo_pixels[2]; fb_ptr[1] = logo_pixels[1]; fb_ptr[2] = logo_pixels[0]; diff --git a/Kernel/Arch/aarch64/kprintf.cpp b/Kernel/Arch/aarch64/kprintf.cpp index 2324a9908a..7a3361fd49 100644 --- a/Kernel/Arch/aarch64/kprintf.cpp +++ b/Kernel/Arch/aarch64/kprintf.cpp @@ -14,7 +14,7 @@ void kernelputstr(char const* characters, size_t length) if (!characters) return; - auto& uart = Prekernel::UART::the(); + auto& uart = Kernel::UART::the(); uart.print_str(characters, length); } @@ -23,7 +23,7 @@ void kernelcriticalputstr(char const* characters, size_t length) if (!characters) return; - auto& uart = Prekernel::UART::the(); + auto& uart = Kernel::UART::the(); uart.print_str(characters, length); } @@ -32,6 +32,6 @@ void kernelearlyputstr(char const* characters, size_t length) if (!characters) return; - auto& uart = Prekernel::UART::the(); + auto& uart = Kernel::UART::the(); uart.print_str(characters, length); } |