MiSlistGetFreePage
INT64 __fastcall MiSlistGetFreePage(_MI_PARTITION *Partition, _MMLISTS PageType, UINT64 Color){
int v3;
__int64 v4;
__int64 v6;
union _SLIST_HEADER *v7;
PSLIST_ENTRY v9;
_QWORD *p_Next;
v3 = **(_DWORD **)&PageType;
v4 = *(_QWORD *)&PageType;
v6 = 16i64 * (unsigned int)Color;
while( 1 )
{
v7 = (union _SLIST_HEADER *)(v6 + *((_QWORD *)Partition + v3 + 525));
if( *(_WORD *)v7 )
{
v9 = RtlpInterlockedPopEntrySList(v7);
p_Next = &v9->Next;
if( v9 )
break;
}
if( v3 == *(_DWORD *)(v4 + 4) )
return 0i64;
v3 = *(_DWORD *)(v4 + 4);
}
v9[1].Next = (_SLIST_ENTRY *)ZeroPte;
if( v3 )
{
MiSetOriginalPtePfnFromFreeList((UINT64 *)&v9[1]);
}
else if( (MiFlags & 0x80u) != 0 && (++dword_140C4E50C & MmPageValidationFrequency) == 0 )
{
MiArePageContentsZero((PVOID)(((char *)v9 - (char *)MmGetPfnDb()) / 48));
}
*p_Next = 0i64;
return(INT64)p_Next;
}Referenced by:
MiGetPageSlist
MiRemovePageAnyColor