MiConvertEntireLargePageToSmall
UINT64 __stdcall MiConvertEntireLargePageToSmall(
KQUEUE *Queue,
INT8 WaitMode,
UINT8 Alertable,
LARGE_INTEGER *Timeout,
LIST_ENTRY **EntryArray,
UINT64 a6){
int v6;
__int64 v8;
_QWORD *v9;
int v10;
char *v11;
unsigned int v12;
UINT64 v13;
unsigned __int8 CurrentIrql;
BOOL ShouldYieldProcessor;
UINT64 result;
UINT64 BlinkValue;
UINT64 SpinCount;
INT64 a4;
v6 = Alertable;
v8 = MiLargePageSizes[WaitMode];
v9 = (_QWORD *)a6;
v10 = 0;
v11 = (char *)Queue + 48 * v8;
v12 = 0;
v13 = v8 + ((char *)Queue - (char *)MmGetPfnDb()) / 48;
BlinkValue = 0xFFFFFFFFFi64;
LODWORD(a4) = (int)Timeout <= 1;
if( Alertable == 1 )
{
v12 = ((_DWORD)Timeout != 0) + 513;
if( a6 )
*(_QWORD *)a6 = 0i64;
}
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
do
{
v11 -= 48;
LODWORD(SpinCount) = v10;
--v13;
if( _interlockedbittestandset64((volatile signed __int32 *)v11 + 6, 0x3Fui64) )
{
do
{
do
KeYieldProcessorEx(&SpinCount);
while( *((__int64 *)v11 + 3) < 0 );
}
while( _interlockedbittestandset64((volatile signed __int32 *)v11 + 6, 0x3Fui64) );
v9 = (_QWORD *)a6;
}
MiConvertLargePfnToSmall((INT64)Queue, (INT64)v11, Alertable, (unsigned int)a4);
v10 = 0;
if( v6 )
{
if( v6 == 1 )
{
if( v11 == (char *)EntryArray )
{
*(_QWORD *)v11 = 0i64;
*((_QWORD *)v11 + 1) |= 0x8000000000000000ui64;
*((_QWORD *)v11 + 2) = ZeroPte;
if( (v12 & 1) != 0 )
{
if( (MiFlags & 0x80u) != 0 && (++dword_140C4E50C & MmPageValidationFrequency) == 0 )
{
MiArePageContentsZero((PVOID)v13);
LABEL_25:
v10 = 0;
}
}
else
{
MiSetOriginalPtePfnFromFreeList((UINT64 *)v11 + 2);
}
}
else if( *((_WORD *)v11 + 16) )
{
if( (*((_QWORD *)v11 + 3) & 0x4000000000000000i64) == 0 )
*((_QWORD *)v11 + 3) |= 0x4000000000000000ui64;
v11[34] |= 7u;
}
else
{
MiInsertPageInFreeOrZeroedList(v13, v12);
v10 = 0;
if( v9 )
++*v9;
}
}
else if( v6 == 2 )
{
*((_QWORD *)v11 + 2) = ZeroPte;
*(_QWORD *)v11 = 0i64;
MiSetPfnBlink((_MMPFN *)v11, BlinkValue, 1ui64);
BlinkValue = v13;
goto LABEL_25;
}
}
_InterlockedAnd64((volatile signed __int64 *)v11 + 3, 0x7FFFFFFFFFFFFFFFui64);
if( (v13 & 0xF) == 0 && CurrentIrql < 2u )
{
ShouldYieldProcessor = KeShouldYieldProcessor();
v10 = 0;
if( ShouldYieldProcessor )
{
__writecr8(CurrentIrql);
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
}
}
}
while( v11 != (char *)Queue );
result = CurrentIrql;
__writecr8(CurrentIrql);
return result;
}Referenced by:
MiCreateKernelHalSlabRange
MiDemoteLocalLargePage
MiFindLargeNodePage
MiGetClusterPage
MiGetPageChain
MiIdealClusterPage
MiInitializeNonPagedPool
MiInsertLargePageChain
MiInsertLargePageInNodeList
MiLargeFreePageToMdl
MiPrefetchPreallocatePages
MiProcessVaContiguityInformation
MiResolvePrivateZeroFault
MiUpdateLargePageSectionPfns