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 LOADER_MEMORY_TYPE MemoryType)
{
PFN_NUMBER CurrentPage, PageNumber;
PFN_NUMBER PageNumber;
PMMPFN Pfn;
/* 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 */
for(PageNumber = 0; PageNumber < PageCount; PageNumber++)
{
/* Get the PFN entry for the current page and set its initial cache attribute */
CurrentPage = BasePage + PageNumber;
Pfn = GetPfnEntry(CurrentPage);
Pfn->u3.e1.CacheAttribute = PfnNonCached;
/* 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 */
LinkFreePage(CurrentPage);
LinkFreePage(BasePage + PageNumber);
}
}
}
else

View File

@@ -186,11 +186,16 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
{
/* Iterate over each page in this free memory run */
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 */
LinkFreePage(BasePage + PageNumber);
}
}
}
else
{
/* Handle all other (non-free) memory types */