1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

Kernel/aarch64: Add {panic,dbgln}_without_mmu

And use it the code that will be part of the early boot process.

The PANIC macro and dbgln functions cannot be used as it accesses global
variables, which in the early boot process do not work, since the MMU is
not yet enabled.
This commit is contained in:
Timon Kruiper 2023-01-07 11:59:37 +01:00 committed by Linus Groh
parent 69c49b3d00
commit 150c52e420
4 changed files with 41 additions and 14 deletions

View file

@ -46,17 +46,17 @@ public:
, m_current(start)
{
if (m_start >= m_end) {
PANIC("Invalid memory range passed to PageBumpAllocator");
panic_without_mmu("Invalid memory range passed to PageBumpAllocator"sv);
}
if ((FlatPtr)m_start % PAGE_TABLE_SIZE != 0 || (FlatPtr)m_end % PAGE_TABLE_SIZE != 0) {
PANIC("Memory range passed into PageBumpAllocator not aligned to PAGE_TABLE_SIZE");
panic_without_mmu("Memory range passed into PageBumpAllocator not aligned to PAGE_TABLE_SIZE"sv);
}
}
u64* take_page()
{
if (m_current == m_end) {
PANIC("Prekernel pagetable memory exhausted");
panic_without_mmu("Prekernel pagetable memory exhausted"sv);
}
u64* page = m_current;
@ -221,8 +221,11 @@ static u64* get_page_directory(u64* root_table, VirtualAddress virtual_addr)
static void setup_kernel_page_directory(u64* root_table)
{
boot_pd_kernel = PhysicalAddress((PhysicalPtr)get_page_directory(root_table, VirtualAddress { kernel_mapping_base }));
VERIFY(!boot_pd_kernel.is_null());
auto kernel_page_directory = (PhysicalPtr)get_page_directory(root_table, VirtualAddress { kernel_mapping_base });
if (!kernel_page_directory)
panic_without_mmu("Could not find kernel page directory!"sv);
boot_pd_kernel = PhysicalAddress(kernel_page_directory);
}
void init_page_tables()