summaryrefslogtreecommitdiff
path: root/Kernel/Memory
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2023-01-07 15:18:33 +0100
committerLinus Groh <mail@linusgroh.de>2023-01-24 14:54:44 +0000
commit5e00bb0b9f8f97b98c63f182b41441697e1cdcf2 (patch)
tree0e7dddc9cc5bc28e53bb799a5082fc65f811c9e5 /Kernel/Memory
parent5db32ecbe16f006a8d46f87443efcb4ec410a8ad (diff)
downloadserenity-5e00bb0b9f8f97b98c63f182b41441697e1cdcf2.zip
Kernel/aarch64: Change MMU::kernel_virtual_range to high virtual memory
This was previously hardcoded this to be the physical memory range, since we identity mapped the memory, however we now run the kernel at a high virtual memory address. Also changes PageDirectory.h to store up-to 512 pages, as the code now needs access to more than 4 pages.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r--Kernel/Memory/MemoryManager.cpp5
-rw-r--r--Kernel/Memory/PageDirectory.h4
2 files changed, 2 insertions, 7 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index 154dba1f77..fb43867104 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -72,9 +72,8 @@ bool MemoryManager::is_initialized()
static UNMAP_AFTER_INIT VirtualRange kernel_virtual_range()
{
#if ARCH(AARCH64)
- // NOTE: We currently identity map the kernel image for aarch64, so the kernel virtual range
- // is the complete memory range.
- return VirtualRange { VirtualAddress((FlatPtr)0), 0x3F000000 };
+ // NOTE: This is not the same as x86_64, because the aarch64 kernel currently doesn't use the pre-kernel.
+ return VirtualRange { VirtualAddress(kernel_mapping_base), KERNEL_PD_END - kernel_mapping_base };
#else
size_t kernel_range_start = kernel_mapping_base + 2 * MiB; // The first 2 MiB are used for mapping the pre-kernel
return VirtualRange { VirtualAddress(kernel_range_start), KERNEL_PD_END - kernel_range_start };
diff --git a/Kernel/Memory/PageDirectory.h b/Kernel/Memory/PageDirectory.h
index 5ae014464c..dfd707d589 100644
--- a/Kernel/Memory/PageDirectory.h
+++ b/Kernel/Memory/PageDirectory.h
@@ -67,11 +67,7 @@ private:
RefPtr<PhysicalPage> m_pml4t;
#endif
RefPtr<PhysicalPage> m_directory_table;
-#if ARCH(X86_64)
RefPtr<PhysicalPage> m_directory_pages[512];
-#else
- RefPtr<PhysicalPage> m_directory_pages[4];
-#endif
RecursiveSpinlock<LockRank::None> m_lock {};
};