From f395f87bb35fbc66c920abf2ea6acb9be9dd49fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 28 Nov 2024 21:11:24 +0100 Subject: [PATCH] [NTOS:MM] MiScanMemoryDescriptors(): Use the MiIsMemoryTypeInvisible() and MiIsMemoryTypeFree() helpers. --- ntoskrnl/mm/ARM3/mminit.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ntoskrnl/mm/ARM3/mminit.c b/ntoskrnl/mm/ARM3/mminit.c index bd5ab3caa88..30e17c6edff 100644 --- a/ntoskrnl/mm/ARM3/mminit.c +++ b/ntoskrnl/mm/ARM3/mminit.c @@ -421,20 +421,14 @@ MiScanMemoryDescriptors(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Count this descriptor */ MiNumberDescriptors++; - /* Check if this is invisible memory */ - if ((Descriptor->MemoryType == LoaderFirmwarePermanent) || - (Descriptor->MemoryType == LoaderSpecialMemory) || - (Descriptor->MemoryType == LoaderHALCachedMemory) || - (Descriptor->MemoryType == LoaderBBTMemory)) - { - /* Skip this descriptor */ + /* If this is invisible memory, skip this descriptor */ + if (MiIsMemoryTypeInvisible(Descriptor->MemoryType)) continue; - } - /* Check if this is bad memory */ + /* Check if this isn't bad memory */ if (Descriptor->MemoryType != LoaderBad) { - /* Count this in the total of pages */ + /* Count it in the physical pages */ MmNumberOfPhysicalPages += (PFN_COUNT)Descriptor->PageCount; } @@ -454,12 +448,9 @@ MiScanMemoryDescriptors(IN PLOADER_PARAMETER_BLOCK LoaderBlock) } /* Check if this is free memory */ - if ((Descriptor->MemoryType == LoaderFree) || - (Descriptor->MemoryType == LoaderLoadedProgram) || - (Descriptor->MemoryType == LoaderFirmwareTemporary) || - (Descriptor->MemoryType == LoaderOsloaderStack)) + if (MiIsMemoryTypeFree(Descriptor->MemoryType)) { - /* Count it too free pages */ + /* Count it in the free pages */ MiNumberOfFreePages += Descriptor->PageCount; /* Check if this is the largest memory descriptor */