fix: init_mmap: use right addr
This commit is contained in:
@ -16,15 +16,15 @@ static void init_mmap(multiboot_info_t *mbd_virt, size_t *pt_index)
|
|||||||
{
|
{
|
||||||
// Index mbd->mmap_addr pointers
|
// Index mbd->mmap_addr pointers
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
for (; i < mbd_virt->mmap_length; i++)
|
for (; i < CEIL(mbd_virt->mmap_length, PAGE_SIZE); i++)
|
||||||
multiboot_page_table[i + *pt_index] =
|
multiboot_page_table[i + *pt_index] =
|
||||||
((mbd_virt->mmap_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
((mbd_virt->mmap_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||||
INIT_FLAGS;
|
INIT_FLAGS;
|
||||||
mmap_addr =
|
mmap_addr =
|
||||||
(multiboot_memory_map_t *)(PTE2VA(PDE_MULTIBOOT, *pt_index) +
|
(multiboot_memory_map_t *)((uint32_t)PTE2VA(PDE_MULTIBOOT, *pt_index) +
|
||||||
(uint32_t)mbd_virt->mmap_addr %
|
(mbd_virt->mmap_addr %
|
||||||
PAGE_SIZE);
|
PAGE_SIZE));
|
||||||
mmap_length = mbd_virt->mmap_length / sizeof(multiboot_memory_map_t);
|
mmap_length = mbd_virt->mmap_length;
|
||||||
*pt_index += i;
|
*pt_index += i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,8 +52,7 @@ 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)");
|
||||||
|
|
||||||
uint32_t *pd = &boot_page_directory;
|
PD[PDE_MULTIBOOT] =
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user