MiPurgeSubsection
UINT64 __stdcall MiPurgeSubsection(_MSUBSECTION *MappedSubsection){
UINT64 v1;
unsigned __int64 v2;
__int64 v4;
__int64 v5;
UINT8 v6;
unsigned int v7;
_MMPFN *v8;
_MMPFN *v9;
ULONG_PTR BugCheckParameter4;
UINT64 v11;
unsigned __int64 v12;
__int64 v13;
unsigned __int64 v14;
UINT64 v16;
UINT8 PageIrql;
UINT64 SpinCount;
__int64 v19;
unsigned __int64 v20;
v2 = *((_QWORD *)MappedSubsection + 1);
v4 = *((unsigned int *)MappedSubsection + 11);
v5 = *(_QWORD *)MappedSubsection;
v6 = 17;
v19 = *(_QWORD *)MappedSubsection;
v7 = 1;
PageIrql = 17;
v8 = 0i64;
v20 = v2 + 8 * v4;
if( v2 >= v20 )
return v7;
while( (v2 & 0xFFF) == 0 || v6 == 17 )
{
if( v6 != 17 )
{
LOBYTE(v1) = v6;
MiUnlockProtoPoolPage(v8, v1);
}
v8 = MiCheckProtoPtePageState((_MMPTE *)v2, &PageIrql);
if( v8 )
{
ExAcquireSpinLockExclusiveAtDpcLevel((INT64 *)(v5 + 72));
if( *((_QWORD *)MappedSubsection + 12) != 1i64 || (*((_BYTE *)MappedSubsection + 32) & 1) != 0 )
{
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v5 + 72));
LOBYTE(v16) = PageIrql;
MiUnlockProtoPoolPage(v8, v16);
return 0i64;
}
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v5 + 72));
v6 = PageIrql;
break;
}
v2 = (v2 & 0xFFFFFFFFFFFFF000ui64) + 4096;
LABEL_26:
v6 = PageIrql;
LABEL_27:
if( v2 >= v20 )
goto LABEL_31;
}
v9 = MiLockLeafPage((_MMPTE *)v2, 0i64);
BugCheckParameter4 = MI_READ_PTE_LOCK_FREE(v2);
v12 = BugCheckParameter4;
if( !v9 )
{
if( (BugCheckParameter4 & 0xC00) == 0 && BugCheckParameter4 )
KeBugCheckEx(0xDEu, 4ui64, (ULONG_PTR)MappedSubsection, v2, BugCheckParameter4);
v2 += 8i64;
goto LABEL_27;
}
if( (BugCheckParameter4 & 1) == 0 )
{
if( qword_140C4DC80 )
{
if( (BugCheckParameter4 & 0x10) != 0 )
v12 = BugCheckParameter4 & 0xFFFFFFFFFFFFFFEFui64;
else
v12 = ~qword_140C4DC80 & BugCheckParameter4;
}
v13 = (v12 >> 12) & 0xFFFFFFFFFi64;
v9 = (_MMPFN *)((char *)MmGetPfnDb() + 48 * v13);
if( (*((_BYTE *)v9 + 34) & 0x10) == 0 && !*((_WORD *)v9 + 16) )
{
MiDereferenceControlAreaPfnList((_CONTROL_AREA *)v5, (_SUBSECTION *)MappedSubsection, v11, 2ui64);
*(_QWORD *)v2 = *((_QWORD *)v9 + 2);
MiUnlinkPageFromList(v9, 0i64);
MiInsertPageInFreeOrZeroedList(v13, 2ui64);
_InterlockedAnd64((volatile signed __int64 *)v9 + 3, 0x7FFFFFFFFFFFFFFFui64);
LODWORD(SpinCount) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)v8 + 6, 0x3Fui64) )
{
do
KeYieldProcessorEx(&SpinCount);
while( *((__int64 *)v8 + 3) < 0 );
}
MiDecrementShareCount((UINT64)v8);
_InterlockedAnd64((volatile signed __int64 *)v8 + 3, 0x7FFFFFFFFFFFFFFFui64);
v5 = v19;
v2 += 8i64;
goto LABEL_26;
}
}
_InterlockedAnd64((volatile signed __int64 *)v9 + 3, 0x7FFFFFFFFFFFFFFFui64);
v6 = PageIrql;
v7 = 0;
LABEL_31:
if( v6 != 17 )
{
LOBYTE(v1) = v6;
MiUnlockProtoPoolPage(v8, v1);
}
if( !v7 )
{
v14 = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)(v5 + 72));
*((_WORD *)MappedSubsection + 16) |= 1u;
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v5 + 72));
__writecr8(v14);
}
return v7;
}Referenced by:
MiDeleteCachedSubsection