[NTOS:MM/x64] "Reserve" the entire kernel space except system cache

RosMm uses MEMORY_AREAs to map sections and VACBs in system space. The previous implementation allowed them to be allocated everywhere, except for regions already used otherwise. This makes sense for x86, where the address space is limited, but we don't need that on x64.
This allows to place all other VA regions where we want without the need to allocate memory areas for completely unused regions that do not even have PXEs mapped.
This commit is contained in:
Timo Kreuzer 2023-05-09 23:21:02 +03:00
parent 34dc4b5c91
commit 3f8dce5133

View file

@ -69,8 +69,12 @@ MiInitSystemMemoryAreas(VOID)
//
#ifdef _M_AMD64
// Reserved range FFFF800000000000 - FFFFF68000000000
MiCreateArm3StaticMemoryArea((PVOID)MI_REAL_SYSTEM_RANGE_START, PTE_BASE - MI_REAL_SYSTEM_RANGE_START, FALSE);
// On x64 we reserve everything except system cache, which is used for all RosMm mappings
ULONG64 SystemCacheStart = (ULONG64)MiSystemVaRegions[AssignedRegionSystemCache].BaseAddress;
ULONG64 SystemCacheEnd = SystemCacheStart + MiSystemVaRegions[AssignedRegionSystemCache].NumberOfBytes;
MiCreateArm3StaticMemoryArea((PVOID)MI_REAL_SYSTEM_RANGE_START, SystemCacheStart - MI_REAL_SYSTEM_RANGE_START, FALSE);
MiCreateArm3StaticMemoryArea((PVOID)SystemCacheEnd, 0xFFFFFFFFFFFFFFFFULL - SystemCacheEnd, FALSE);
return;
#endif /* _M_AMD64 */
// The loader mappings. The only Executable area.