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

@ -54,7 +54,7 @@ fast-run-iso: fast-iso
qemu-system-i386 -cdrom build/$(NAME).iso -vga std qemu-system-i386 -cdrom build/$(NAME).iso -vga std
debug: fast-iso debug: fast-iso
qemu-system-i386 -s -S -cdrom build/$(NAME).iso -vga std -d in_asm,int -M smm=off qemu-system-i386 -s -S -cdrom build/$(NAME).iso -vga std -M smm=off
clean: clean:
make -C libbozo clean make -C libbozo clean

View File

@ -37,7 +37,8 @@ static void init_vbe(multiboot_info_t *mbd_virt)
((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) | ((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) |
INIT_FLAGS; 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) + display.buff = (uint32_t *)PTE2VA(PDE_VBE, 0) +
(mbd_virt->framebuffer_addr % PAGE_SIZE); (mbd_virt->framebuffer_addr % PAGE_SIZE);
display.height = mbd_virt->framebuffer_height; 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) if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
kpanic("invalid magic number! (git gud skill issue)"); 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; ((uint32_t)multiboot_page_table - VIRT_OFFSET) | INIT_FLAGS;
size_t pt_index = CEIL( size_t pt_index = CEIL(
(uint32_t)mbd % PAGE_SIZE + sizeof(multiboot_info_t), PAGE_SIZE); (uint32_t)mbd % PAGE_SIZE + sizeof(multiboot_info_t), PAGE_SIZE);