Interface cleanup

This commit is contained in:
2018-02-15 14:20:10 +01:00
parent 9a479b1132
commit 8711fee390
4 changed files with 36 additions and 19 deletions

View File

@@ -16,28 +16,11 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
debug_info("Kernel was loaded with command line \"%s\", by <%s>\n", kernel_boot_data.commandline, kernel_boot_data.bootloader);
memory_init();
cpu_init();
uintptr_t start, end;
uint32_t type, i=0;
while(!multiboot_get_memory_area(i++, &start, &end, &type))
{
debug("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(vmm_get_page(&BootP4, (uintptr_t)P2V(p)) == (uintptr_t)-1)
{
touch_page(&BootP4, (uintptr_t)P2V(p), PAGE_GLOBAL | PAGE_WRITE | PAGE_HUGE);
vmm_set_page(&BootP4, (uintptr_t)P2V(p), p, PAGE_GLOBAL | PAGE_HUGE | PAGE_WRITE | PAGE_PRESENT);
}
if(type == 1)
pmm_free(p);
}
}
debug_ok("Boot \"Complete\"\n");
PANIC("Reached end of kernel main function\n");