Map the page bitmap to virtual memory

This commit is contained in:
apio 2022-12-07 10:58:59 +01:00
parent 1ebd892c16
commit dad95a8160
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -99,6 +99,17 @@ namespace MemoryManager
init_physical_frame_allocator();
KernelVM::init();
MMU::setup_initial_page_directory();
// NOTE: We force these operations to succeed, because if we can't map the frame bitmap to virtual memory
// there's no point in continuing.
auto bitmap_pages = g_frame_bitmap.size_in_bytes() / ARCH_PAGE_SIZE;
auto virtual_bitmap_base = KernelVM::alloc_several_pages(bitmap_pages).release_value();
map_frames_at(virtual_bitmap_base, (u64)g_frame_bitmap.location(), bitmap_pages,
MMU::ReadWrite | MMU::NoExecute)
.release_value();
g_frame_bitmap.initialize((void*)virtual_bitmap_base, g_frame_bitmap.size_in_bytes());
}
void lock_frame(u64 frame)