mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[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:
@@ -118,14 +118,7 @@ memory_initialize_post_ctors(args::header *kargs)
|
|||||||
page_table *kpml4 = reinterpret_cast<page_table*>(kargs->pml4);
|
page_table *kpml4 = reinterpret_cast<page_table*>(kargs->pml4);
|
||||||
for (unsigned i = pml4e_kernel; i < pml4e_offset; ++i) {
|
for (unsigned i = pml4e_kernel; i < pml4e_offset; ++i) {
|
||||||
page_table *pdp = kpml4->get(i);
|
page_table *pdp = kpml4->get(i);
|
||||||
|
kassert(pdp, "Bootloader did not create all kernelspace PDs");
|
||||||
if (!pdp) {
|
|
||||||
if (current_bytes)
|
|
||||||
g_kernel_space.commit(current_start, current_bytes);
|
|
||||||
current_start = 0;
|
|
||||||
current_bytes = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
walk_page_table(
|
walk_page_table(
|
||||||
pdp, page_table::level::pdp,
|
pdp, page_table::level::pdp,
|
||||||
@@ -133,6 +126,9 @@ memory_initialize_post_ctors(args::header *kargs)
|
|||||||
g_kernel_space);
|
g_kernel_space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (current_bytes)
|
||||||
|
g_kernel_space.commit(current_start, current_bytes);
|
||||||
|
|
||||||
g_frame_allocator.free(
|
g_frame_allocator.free(
|
||||||
reinterpret_cast<uintptr_t>(kargs->page_table_cache),
|
reinterpret_cast<uintptr_t>(kargs->page_table_cache),
|
||||||
kargs->num_free_tables);
|
kargs->num_free_tables);
|
||||||
|
|||||||
Reference in New Issue
Block a user