InitRD: leak an unused pointer so kmalloc() doesn't map memory all the time

This commit is contained in:
apio 2022-10-20 18:49:00 +02:00
parent 7d71bd192d
commit 073c90e948

View File

@ -375,8 +375,10 @@ void InitRD::init()
(void*)bootboot.initrd_ptr, Utilities::get_blocks_from_size(PAGE_SIZE, bootboot.initrd_size)); (void*)bootboot.initrd_ptr, Utilities::get_blocks_from_size(PAGE_SIZE, bootboot.initrd_size));
kdbgln("physical base at %lx, size %lx, mapped to %p", bootboot.initrd_ptr, bootboot.initrd_size, initrd_base); kdbgln("physical base at %lx, size %lx, mapped to %p", bootboot.initrd_ptr, bootboot.initrd_size, initrd_base);
kdbgln("total blocks: %ld", get_total_blocks()); kdbgln("total blocks: %ld", get_total_blocks());
void* leak = kmalloc(4); // leak some memory so that kmalloc doesn't continually allocate and free pages
initrd_initialize_root(); initrd_initialize_root();
initrd_scan(); initrd_scan();
VFS::mount_root(&initrd_root); VFS::mount_root(&initrd_root);
initrd_initialized = true; initrd_initialized = true;
kfree(leak);
} }