MiGetLargePagesDemoteAsNeeded
INT64 __fastcall MiGetLargePagesDemoteAsNeeded(
INT64 a1,
UINT64 a2,
UINT64 a3,
UINT64 a4,
INT64 a5,
INT64 arg28,
INT64 a7){
int v7;
INT64 v8;
__int64 v9;
unsigned int v10;
unsigned int v11;
__int64 v12;
int v13;
__int64 *v14;
unsigned int v15;
_QWORD *v16;
UINT64 v17;
unsigned int v18;
INT64 v19;
INT64 result;
signed __int32 v21;
INT64 v22;
INT64 v23;
UINT64 v24;
INT64 a6;
INT64 v26;
INT64 v27;
INT64 v28[2];
UINT64 v30;
UINT64 v31;
v31 = a4;
v30 = a3;
v7 = a2;
v8 = a1;
v9 = *(_QWORD *)(a1 + 16) + 4544i64 * (unsigned int)a2;
if( !*(_QWORD *)(v9 + 4176) && *(_DWORD *)InitializationPhase )
return 0i64;
v10 = arg28;
v11 = 0;
v12 = 0i64;
v13 = !(arg28 & 1) + 1;
if( (arg28 & 1) == 0 )
v10 = arg28 | 1;
while( 1 )
{
v14 = MiLargePageSizes;
v15 = 0;
v16 = (_QWORD *)(v9 + 16 * (v12 + 1));
do
{
v17 = *v14;
if( a3 >= *v14 )
{
if( v17 < a4 )
break;
v18 = v15;
if( v11 )
v18 = v11;
v11 = v18;
if( v16[1] || *v16 )
{
if( (_DWORD)a5 )
v19 = a3 / v17;
else
v19 = 1i64;
LODWORD(v27) = a7;
LODWORD(v26) = 4;
LODWORD(a6) = 0;
LODWORD(v24) = v7;
result = MiGetFreeZeroLargePages(v8, v15, v19, v10, v24, a6, v26, v27);
if( result )
return result;
v8 = a1;
a3 = v30;
a4 = v31;
}
}
++v15;
++v14;
v16 += 134;
}
while( v15 < 3 );
if( v11 )
{
*(_OWORD *)v28 = 0i64;
MiInitializePageColorBase(0i64, (unsigned int)(v7 + 1), (INT64)v28);
v21 = _InterlockedExchangeAdd((volatile signed __int32 *)v28[0], 1u);
LODWORD(v24) = v10;
result = MiGetLargePage(v22, v11, (unsigned int)a7, HIDWORD(v28[1]) | (unsigned int)v21 & v28[1], v24, v23);
if( result )
return result;
}
if( !--v13 )
return 0i64;
v8 = a1;
v10 &= ~1u;
a3 = v30;
v12 = 1i64;
a4 = v31;
}
}Referenced by:
MiFindLargeNodePage
MiGetFastLargePages
MiGetLargePageChain
MiTimeSingleLargePageZeroWorker