summaryrefslogtreecommitdiff
path: root/Kernel/VM/PageDirectory.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-07-07 19:50:05 -0600
committerAndreas Kling <kling@serenityos.org>2021-07-08 11:43:34 +0200
commit87dc4c3d2c21762d85c77b7b9588ff889cafb5ac (patch)
tree03b6c4ca2c580060e3d0c2a1ffe398c5b53a51ac /Kernel/VM/PageDirectory.cpp
parentad5d9d648b835f665e7a3e3eb0847c651d9c8c20 (diff)
downloadserenity-87dc4c3d2c21762d85c77b7b9588ff889cafb5ac.zip
Kernel: Move PhysicalPage classes out of the heap into an array
By moving the PhysicalPage classes out of the kernel heap into a static array, one for each physical page, we can avoid the added overhead and easily find them by indexing into an array. This also wraps the PhysicalPage into a PhysicalPageEntry, which allows us to re-use each slot with information where to find the next free page.
Diffstat (limited to 'Kernel/VM/PageDirectory.cpp')
-rw-r--r--Kernel/VM/PageDirectory.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp
index 5bc2da0f6d..3fd515697f 100644
--- a/Kernel/VM/PageDirectory.cpp
+++ b/Kernel/VM/PageDirectory.cpp
@@ -37,9 +37,12 @@ extern "C" PageDirectoryEntry boot_pd3[1024];
UNMAP_AFTER_INIT PageDirectory::PageDirectory()
{
- m_range_allocator.initialize_with_range(VirtualAddress(KERNEL_BASE + 0x02000000), 0x2f000000);
+ m_range_allocator.initialize_with_range(VirtualAddress(KERNEL_BASE + KERNEL_PD_OFFSET), KERNEL_PD_END - (KERNEL_BASE + KERNEL_PD_OFFSET));
m_identity_range_allocator.initialize_with_range(VirtualAddress(FlatPtr(0x00000000)), 0x00200000);
+}
+UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
+{
// Adopt the page tables already set up by boot.S
#if ARCH(X86_64)
PhysicalAddress boot_pml4t_paddr(virtual_to_low_physical((FlatPtr)boot_pml4t));