Map all free memory pages and add to page stack
This commit is contained in:
@@ -22,7 +22,22 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
|
||||
uintptr_t start, end;
|
||||
uint32_t type, i=0;
|
||||
while(!multiboot_get_memory_area(i++, &start, &end, &type))
|
||||
{
|
||||
if(type != 1)
|
||||
continue;
|
||||
debug_printf("Mem %d 0x%x-0x%x\n", type, start, end);
|
||||
for(uintptr_t p = start; p < end; p += PAGE_SIZE)
|
||||
{
|
||||
if(p >= V2P(&kernel_start) && p < V2P(&kernel_end))
|
||||
continue;
|
||||
if(!(p & 0x1FFFFF))
|
||||
{
|
||||
touch_page(&BootP4, (uintptr_t)P2V(p), PAGE_HUGE);
|
||||
vmm_set_page(&BootP4, (uintptr_t)P2V(p), p, PAGE_HUGE | PAGE_WRITE | PAGE_PRESENT);
|
||||
}
|
||||
pmm_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
debug_ok("Boot \"Complete\"\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user