Allow PFN insertion at the beginning of standby list
This commit is contained in:
@@ -40,9 +40,11 @@ namespace MM
|
|||||||
STATIC XTAPI PFN_NUMBER AllocatePhysicalPage(IN ULONG Color);
|
STATIC XTAPI PFN_NUMBER AllocatePhysicalPage(IN ULONG Color);
|
||||||
STATIC XTAPI VOID ComputePfnDatabaseSize(VOID);
|
STATIC XTAPI VOID ComputePfnDatabaseSize(VOID);
|
||||||
STATIC XTAPI VOID DecrementReferenceCount(IN PMMPFN Pfn1,
|
STATIC XTAPI VOID DecrementReferenceCount(IN PMMPFN Pfn1,
|
||||||
IN PFN_NUMBER PageFrameIndex);
|
IN PFN_NUMBER PageFrameIndex,
|
||||||
|
IN BOOLEAN BeginStandbyList = FALSE);
|
||||||
STATIC XTAPI VOID DecrementShareCount(IN PMMPFN Pfn1,
|
STATIC XTAPI VOID DecrementShareCount(IN PMMPFN Pfn1,
|
||||||
IN PFN_NUMBER PageFrameIndex);
|
IN PFN_NUMBER PageFrameIndex,
|
||||||
|
IN BOOLEAN BeginStandbyList = FALSE);
|
||||||
STATIC XTAPI VOID FreePhysicalPage(IN PMMPTE PointerPte);
|
STATIC XTAPI VOID FreePhysicalPage(IN PMMPTE PointerPte);
|
||||||
STATIC XTAPI ULONG_PTR GetHighestPhysicalPage(VOID);
|
STATIC XTAPI ULONG_PTR GetHighestPhysicalPage(VOID);
|
||||||
STATIC XTAPI ULONGLONG GetNumberOfPhysicalPages(VOID);
|
STATIC XTAPI ULONGLONG GetNumberOfPhysicalPages(VOID);
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ MM::Pfn::DecrementAvailablePages(VOID)
|
|||||||
* @param PageFrameIndex
|
* @param PageFrameIndex
|
||||||
* The page frame number of the physical page.
|
* The page frame number of the physical page.
|
||||||
*
|
*
|
||||||
|
* @param BeginStandbyList
|
||||||
|
* Determines whether the page should be added to the beginning of the standby list.
|
||||||
|
*
|
||||||
* @return This routine does not return any value.
|
* @return This routine does not return any value.
|
||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
@@ -145,7 +148,8 @@ MM::Pfn::DecrementAvailablePages(VOID)
|
|||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
|
MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
|
||||||
IN PFN_NUMBER PageFrameIndex)
|
IN PFN_NUMBER PageFrameIndex,
|
||||||
|
IN BOOLEAN BeginStandbyList)
|
||||||
{
|
{
|
||||||
/* Decrement the PFN reference count */
|
/* Decrement the PFN reference count */
|
||||||
PageFrameNumber->u3.e2.ReferenceCount--;
|
PageFrameNumber->u3.e2.ReferenceCount--;
|
||||||
@@ -203,9 +207,17 @@ MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Link clean page to the standby list */
|
/* Link clean page to the standby list */
|
||||||
|
if(BeginStandbyList)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Link clean page to the end of the standby list */
|
||||||
LinkPage(&StandbyPagesList, PageFrameIndex);
|
LinkPage(&StandbyPagesList, PageFrameIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -217,6 +229,9 @@ MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
|
|||||||
* @param PageFrameIndex
|
* @param PageFrameIndex
|
||||||
* The page frame number of the physical page.
|
* The page frame number of the physical page.
|
||||||
*
|
*
|
||||||
|
* @param BeginStandbyList
|
||||||
|
* Determines whether the page should be added to the beginning of the standby list.
|
||||||
|
*
|
||||||
* @return This routine does not return any value.
|
* @return This routine does not return any value.
|
||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
@@ -224,7 +239,8 @@ MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
|
|||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
MM::Pfn::DecrementShareCount(IN PMMPFN PageFrameNumber,
|
MM::Pfn::DecrementShareCount(IN PMMPFN PageFrameNumber,
|
||||||
IN PFN_NUMBER PageFrameIndex)
|
IN PFN_NUMBER PageFrameIndex,
|
||||||
|
IN BOOLEAN BeginStandbyList)
|
||||||
{
|
{
|
||||||
/* Ensure the page is in a valid state */
|
/* Ensure the page is in a valid state */
|
||||||
if((PageFrameNumber->u3.e1.PageLocation != ActiveAndValid) &&
|
if((PageFrameNumber->u3.e1.PageLocation != ActiveAndValid) &&
|
||||||
@@ -280,7 +296,7 @@ MM::Pfn::DecrementShareCount(IN PMMPFN PageFrameNumber,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The PTE can not be removed yet, decrement the reference count */
|
/* The PTE can not be removed yet, decrement the reference count */
|
||||||
DecrementReferenceCount(PageFrameNumber, PageFrameIndex);
|
DecrementReferenceCount(PageFrameNumber, PageFrameIndex, BeginStandbyList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -317,13 +333,13 @@ MM::Pfn::FreePhysicalPage(IN PMMPTE PointerPte)
|
|||||||
PageTableFrame = MM::Pfn::GetPfnEntry(PageTableFrameNumber);
|
PageTableFrame = MM::Pfn::GetPfnEntry(PageTableFrameNumber);
|
||||||
|
|
||||||
/* Decrement the share count of the page table */
|
/* Decrement the share count of the page table */
|
||||||
MM::Pfn::DecrementShareCount(PageTableFrame, PageTableFrameNumber);
|
MM::Pfn::DecrementShareCount(PageTableFrame, PageTableFrameNumber, FALSE);
|
||||||
|
|
||||||
/* Mark the PTE as being ready for removal */
|
/* Mark the PTE as being ready for removal */
|
||||||
MM::Paging::SetPte(PageFrame->PteAddress, MM::Paging::GetPte(PageFrame->PteAddress) | 1);
|
MM::Paging::SetPte(PageFrame->PteAddress, MM::Paging::GetPte(PageFrame->PteAddress) | 1);
|
||||||
|
|
||||||
/* Decrement the share count of the page */
|
/* Decrement the share count of the page */
|
||||||
MM::Pfn::DecrementShareCount(PageFrame, PageFrameNumber);
|
MM::Pfn::DecrementShareCount(PageFrame, PageFrameNumber, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user