MmRelocatePfnList
NTSTATUS __stdcall MmRelocatePfnList(
UINT64 PfnCount,
_MMPFN_IDENTITY *PfnList,
UINT64 PreferredNode,
UINT64 PreferredChannel){
int v7;
_ETHREAD *CurrentThread;
_MMPFN_IDENTITY *v9;
UINT64 v10;
__int64 v11;
int v12;
_MMPFN *v13;
__int64 v14;
__int64 v15;
__int64 v16;
UINT64 *ReplacementColor;
UINT64 *ReplacementPage;
_MMPFN_IDENTITY Identity[4];
__int64 v20;
_MMPTE_COPY_LIST PteCopyList[4];
__int64 v22;
UINT64 DrainStacks;
LODWORD(DrainStacks) = 0;
v20 = 0i64;
v22 = 0i64;
*(_OWORD *)Identity = 0i64;
*(_OWORD *)PteCopyList = 0i64;
if( (unsigned int)PreferredNode >= (unsigned __int16)KeNumberNodes )
return -1073741584;
if( (unsigned int)PreferredChannel >= MmNumberOfChannels )
return -1073741583;
v7 = ((_DWORD)PreferredNode << *(&stru_140C4DB30 + 156)) | ((_DWORD)PreferredChannel << *(&stru_140C4DB30 + 157));
MiCreatePteCopyList(PfnCount, 0x100ui64, PteCopyList);
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
v9 = &PfnList[6 * PfnCount];
MiLockDynamicMemoryShared((INT64)&Irp, (INT64)CurrentThread);
while( PfnList < v9 )
{
v10 = *((_QWORD *)PfnList + 1);
v11 = 0i64;
*(_QWORD *)Identity = 0i64;
v20 = 0i64;
*(_QWORD *)&Identity[2] = v10;
MiIsPfn(v10);
if( v12 )
{
v13 = &MmGetPfnDb()[v10];
MiIdentifyPfnWrapper(v13, Identity);
v11 = v20;
if( v20 == *((_QWORD *)PfnList + 2) && ((*(_QWORD *)Identity ^ *(_QWORD *)PfnList) & 0x1FFFFFFFFFFFE00i64) == 0 )
{
MiPfnsWorthTrying(&Irp, v13, 1ui64, 0i64, &DrainStacks, ReplacementColor);
if( !v14 )
{
if( (_DWORD)DrainStacks == 1 )
MiEmptyKernelStackCache();
LODWORD(ReplacementPage) = v7;
LODWORD(ReplacementColor) = 0x400000;
LODWORD(v15) = MiClaimPhysicalRun(
&Irp,
v10,
1ui64,
(_MMPTE_COPY_LIST *)0xFFFFFFFFFi64,
(UINT64)PteCopyList,
(UINT64)ReplacementColor,
ReplacementPage);
if( !v15 )
{
*(_QWORD *)&Identity[2] = 0i64;
goto LABEL_16;
}
}
v11 = v20;
}
}
v20 = v11 | 2;
LABEL_16:
v16 = v20;
*(_OWORD *)PfnList = *(_OWORD *)Identity;
*((_QWORD *)PfnList + 2) = v16;
PfnList += 6;
}
MiUnlockDynamicMemoryShared((INT64)&Irp, (INT64)CurrentThread);
MiReleasePteCopyList(PteCopyList);
return 0;
}Referenced by:
PfpPfnPrioRequest