[kernel] Assert all PDs exist in kernel space

The bootloader now creates all PD tables in kernel space, so remove
memory_bootstrap.cpp code that dealt with cases where there was no PD
for a given range, and kassert that all PDs exist.

Also deal with the case where the final PD exists, which never committed
the last address range.
This commit is contained in:
2020-08-06 19:07:51 -07:00
parent 579eaaf4a0
commit 55bc49598e

View File

@@ -118,14 +118,7 @@ memory_initialize_post_ctors(args::header *kargs)
page_table *kpml4 = reinterpret_cast<page_table*>(kargs->pml4);
for (unsigned i = pml4e_kernel; i < pml4e_offset; ++i) {
page_table *pdp = kpml4->get(i);
if (!pdp) {
if (current_bytes)
g_kernel_space.commit(current_start, current_bytes);
current_start = 0;
current_bytes = 0;
continue;
}
kassert(pdp, "Bootloader did not create all kernelspace PDs");
walk_page_table(
pdp, page_table::level::pdp,
@@ -133,6 +126,9 @@ memory_initialize_post_ctors(args::header *kargs)
g_kernel_space);
}
if (current_bytes)
g_kernel_space.commit(current_start, current_bytes);
g_frame_allocator.free(
reinterpret_cast<uintptr_t>(kargs->page_table_cache),
kargs->num_free_tables);