MiClaimPhysicalRun
NTSTATUS __stdcall MiClaimPhysicalRun(
_MI_PARTITION *Partition,
UINT64 PageFrameIndex,
UINT64 SizeInPages,
_MMPTE_COPY_LIST *PteCopyList,
UINT64 Flags,
UINT64 ReplacementColor,
UINT64 *ReplacementPage){
UINT64 v7;
_QWORD *v8;
__int64 v10;
NTSTATUS v11;
_MMPFN *v12;
unsigned __int64 v13;
unsigned __int64 v14;
UINT64 v16;
INT64 v17[2];
UINT64 v18;
int v19;
int v20;
int v21;
int v22;
__int64 v23;
unsigned __int64 v24;
_MMPTE_COPY_LIST *v25;
__int64 v26;
int ReplacementPagea;
__int64 v28;
_MMPFN *v29;
int v30;
_QWORD *v31;
UINT64 v32;
v22 = 0;
v7 = PageFrameIndex;
v24 = 0i64;
v8 = v31;
if( v31 )
*v31 = -1i64;
v10 = v28;
v11 = SizeInPages;
v17[1] = Flags;
v20 = (int)ReplacementPage;
v21 = v30;
v17[0] = (INT64)Partition;
ReplacementPagea = 0;
v26 = v28;
v19 = ReplacementColor;
v18 = SizeInPages;
v25 = PteCopyList;
v23 = -1i64;
v12 = &MmGetPfnDb()[PageFrameIndex];
v29 = &v12[SizeInPages];
v32 = PageFrameIndex + SizeInPages;
while( 1 )
{
LODWORD(v13) = MiTradePage((INT64)v17, v7);
v14 = v13;
if( !v13 )
{
v14 = 1i64;
if( v24 > 1 )
{
if( v7 == (v7 & ~(v24 - 1)) )
v14 = v24;
else
v14 = (~(v24 - 1) & (v7 + v24 - 1)) - v7;
}
if( !ReplacementPagea )
{
if( v24 )
v11 = v32 - (v7 & ~(v24 - 1));
ReplacementPagea = 1;
}
if( (ReplacementColor & 0x2000) == 0 )
goto LABEL_20;
if( v14 >= v32 - v7 )
goto LABEL_10;
goto LABEL_9;
}
v18 -= v13;
if( !v18 )
break;
LABEL_9:
v7 += v14;
v12 += v14;
if( v12 >= v29 )
{
LABEL_10:
if( (ReplacementColor & 0x2000) == 0 )
{
LABEL_20:
v16 = SizeInPages - v18;
if( v10 )
*(_DWORD *)(v10 + 40) += -4096 * v16;
for( ; v16; --v16 )
MiReleaseFreshPage(--v12);
}
return v11;
}
}
if( (ReplacementColor & 0x400000) != 0 && v8 )
*v8 = v23;
return 0;
}Referenced by:
MiFindContiguousPages
MiScrubNode
MmRelocatePfnList