fix: multiboot using unmapped pd

This commit is contained in:
0x35c
2025-11-28 11:12:14 +01:00
parent c33f8fc05d
commit 9b1a0f9f4f
2 changed files with 5 additions and 3 deletions

View File

@ -37,7 +37,8 @@ static void init_vbe(multiboot_info_t *mbd_virt)
((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) |
INIT_FLAGS;
}
PD[PDE_VBE] = ((uint32_t)vbe_page_table - VIRT_OFFSET) | INIT_FLAGS;
uint32_t *pd = &boot_page_directory;
pd[PDE_VBE] = ((uint32_t)vbe_page_table - VIRT_OFFSET) | INIT_FLAGS;
display.buff = (uint32_t *)PTE2VA(PDE_VBE, 0) +
(mbd_virt->framebuffer_addr % PAGE_SIZE);
display.height = mbd_virt->framebuffer_height;
@ -51,7 +52,8 @@ void init_multiboot(multiboot_info_t *mbd, uint32_t magic)
if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
kpanic("invalid magic number! (git gud skill issue)");
PD[PDE_MULTIBOOT] =
uint32_t *pd = &boot_page_directory;
pd[PDE_MULTIBOOT] =
((uint32_t)multiboot_page_table - VIRT_OFFSET) | INIT_FLAGS;
size_t pt_index = CEIL(
(uint32_t)mbd % PAGE_SIZE + sizeof(multiboot_info_t), PAGE_SIZE);