Prevent adding referenced pages to the free list
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 37s
Builds / ExectOS (amd64, debug) (push) Successful in 29s
Builds / ExectOS (i686, debug) (push) Successful in 28s
Builds / ExectOS (i686, release) (push) Successful in 34s

This commit is contained in:
2026-01-06 15:01:05 +01:00
parent bee91d0c71
commit b91c79e090
2 changed files with 15 additions and 10 deletions

View File

@@ -189,7 +189,7 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
IN PFN_NUMBER PageCount, IN PFN_NUMBER PageCount,
IN LOADER_MEMORY_TYPE MemoryType) IN LOADER_MEMORY_TYPE MemoryType)
{ {
PFN_NUMBER CurrentPage, PageNumber; PFN_NUMBER PageNumber;
PMMPFN Pfn; PMMPFN Pfn;
/* Check if the memory descriptor describes a free memory region */ /* Check if the memory descriptor describes a free memory region */
@@ -198,13 +198,13 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
/* Iterate over each page in this free memory run */ /* Iterate over each page in this free memory run */
for(PageNumber = 0; PageNumber < PageCount; PageNumber++) for(PageNumber = 0; PageNumber < PageCount; PageNumber++)
{ {
/* Get the PFN entry for the current page and set its initial cache attribute */ /* Get the PFN entry for the current page and ensure it is not referenced */
CurrentPage = BasePage + PageNumber; Pfn = GetPfnEntry(BasePage + PageNumber);
Pfn = GetPfnEntry(CurrentPage); if(Pfn->u3.e2.ReferenceCount == 0)
Pfn->u3.e1.CacheAttribute = PfnNonCached; {
/* Add the page to the free list to make it available for allocation */ /* Add the page to the free list to make it available for allocation */
LinkFreePage(CurrentPage); LinkFreePage(BasePage + PageNumber);
}
} }
} }
else else

View File

@@ -186,11 +186,16 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
{ {
/* Iterate over each page in this free memory run */ /* Iterate over each page in this free memory run */
for(PageNumber = 0; PageNumber < PageCount; PageNumber++) for(PageNumber = 0; PageNumber < PageCount; PageNumber++)
{
/* Get the PFN entry for the current page and ensure it is not referenced */
Pfn = GetPfnEntry(BasePage + PageNumber);
if(Pfn->u3.e2.ReferenceCount == 0)
{ {
/* Add the page to the free list to make it available for allocation */ /* Add the page to the free list to make it available for allocation */
LinkFreePage(BasePage + PageNumber); LinkFreePage(BasePage + PageNumber);
} }
} }
}
else else
{ {
/* Handle all other (non-free) memory types */ /* Handle all other (non-free) memory types */