From a62732ee2f029ca388b358e3cc013df9f1951d9d Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Wed, 21 Sep 2022 16:16:39 +0200 Subject: Kernel/aarch64: Only identity map kernel image, instead of all of RAM For the initial page tables we only need to identity map the kernel image, the rest of the memory will be managed by the MemoryManager. The linker script is updated to get the kernel image start and end addresses. --- Kernel/Memory/MemoryManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Kernel/Memory/MemoryManager.cpp') diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 5710235f62..33fb51c806 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -72,8 +72,14 @@ 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 }; +#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 }; +#endif } MemoryManager::GlobalData::GlobalData() -- cgit v1.2.3