[kernel] Use constants for known pml4e indices
There were a few lingering bugs due to places where 510/511 were hard-coded as the kernel-space PML4 entries. These are now constants defined in kernel_memory.h instead. Tags: boot memory paging
This commit is contained in:
@@ -165,7 +165,7 @@ add_current_mappings(page_table *new_pml4)
|
||||
asm volatile ( "mov %%cr3, %0" : "=r" (old_pml4) );
|
||||
|
||||
// Only copy mappings in the lower half
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
for (int i = 0; i < ::memory::pml4e_kernel; ++i) {
|
||||
uint64_t entry = old_pml4->entries[i];
|
||||
if (entry & 1)
|
||||
new_pml4->entries[i] = entry;
|
||||
|
||||
Reference in New Issue
Block a user