mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTOS]: At times, pages may be removed from the zero or free page list, but without being initialized as part of the PFN database, such that their PageLocation has not changed. However, we can detect these pages because their link pointers will be NULL, meaning they're not _really_ free or zeroed. Use this enhanced check when verifying if a page is in use or not, and additionally triple-check by making sure the reference count is zero. This now matches the Windows checks. We also consider Standby pages (not yet implemented) as usable, since we can always steal them.
svn path=/trunk/; revision=47148
This commit is contained in:
parent
b6b00740ca
commit
a38d98d504
1 changed files with 13 additions and 2 deletions
|
@ -128,12 +128,23 @@ MmRemoveLRUUserPage(PFN_TYPE Page)
|
|||
RtlClearBit(&MiUserPfnBitMap, Page);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
MiIsPfnFree(IN PMMPFN Pfn1)
|
||||
{
|
||||
/* Must be a free or zero page, with no references, linked */
|
||||
return ((Pfn1->u3.e1.PageLocation <= StandbyPageList) &&
|
||||
(Pfn1->u1.Flink) &&
|
||||
(Pfn1->u2.Blink) &&
|
||||
!(Pfn1->u3.e2.ReferenceCount));
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
MiIsPfnInUse(IN PMMPFN Pfn1)
|
||||
{
|
||||
return ((Pfn1->u3.e1.PageLocation != FreePageList) &&
|
||||
(Pfn1->u3.e1.PageLocation != ZeroedPageList));
|
||||
/* Standby list or higher, unlinked, and with references */
|
||||
return !MiIsPfnFree(Pfn1);
|
||||
}
|
||||
|
||||
PFN_NUMBER
|
||||
|
|
Loading…
Reference in a new issue