Prevent adding referenced pages to the free list
This commit is contained in:
@@ -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(BasePage + PageNumber);
|
||||||
LinkFreePage(CurrentPage);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -187,8 +187,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++)
|
||||||
{
|
{
|
||||||
/* Add the page to the free list to make it available for allocation */
|
/* Get the PFN entry for the current page and ensure it is not referenced */
|
||||||
LinkFreePage(BasePage + PageNumber);
|
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
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user