MiAllocateLargeZeroPages
_MI_LARGEPAGE_MEMORY_INFO *__stdcall MiAllocateLargeZeroPages(
UINT64 NumberOfPages,
UINT64 PreferredNode,
UINT64 ProtectionMask,
UINT64 a4,
UINT64 ZeroFillNeeded){
int v5;
unsigned int v6;
int v8;
UINT64 v9;
INT64 v10;
_MI_PARTITION *v11;
int v12;
_MI_LARGEPAGE_MEMORY_INFO *v13;
__int64 v14;
INT64 v15;
INT64 v16;
int v17;
INT64 v18;
__int64 v19;
__int64 v20;
_QWORD *v21;
CHAR *v22;
INT64 v23;
CHAR **v24;
unsigned int v25;
unsigned int v26;
INT64 v27;
CHAR **v28;
CHAR *v29;
CHAR *v30;
INT64 ProtectionMaska;
INT64 a6;
int v34;
_RTL_AVL_TREE Tree;
UINT64 v36;
CHAR *v37;
CHAR **v38;
INT64 v39;
__int64 v40;
__int64 CurrentIrql;
UINT64 PreferredNodea;
_MI_PARTITION *Partition;
INT64 v44[2];
__int128 v45;
__int128 v46;
INT64 v47;
int v48;
v5 = v48;
Partition = (_MI_PARTITION *)NumberOfPages;
v6 = a4;
LODWORD(v36) = ZeroFillNeeded;
v39 = v47;
*(_OWORD *)v44 = 0i64;
PreferredNodea = ProtectionMask;
v45 = 0i64;
v46 = 0i64;
CurrentIrql = KeGetCurrentIrql();
LODWORD(Tree.Root) = MiProtectionToCacheAttribute((unsigned int)ZeroFillNeeded);
v12 = 0;
v34 = 0;
v38 = &v37;
v13 = 0i64;
v37 = (CHAR *)&v37;
if( v14 )
{
do
{
LODWORD(a6) = v5;
LODWORD(ProtectionMaska) = v8;
LODWORD(v15) = MiGetFastLargePages((INT64)v11, v6, PreferredNode - (_QWORD)v13, v10, ProtectionMaska, a6);
v16 = v15;
if( !v15 )
{
v12 = v34;
break;
}
v17 = v5 & 2;
do
{
v18 = *(_QWORD *)v16;
if( !v17 )
MiIsFreshPfnFromZeroedList(v16);
v40 = MiLargePageSizes[MiGetPfnPageSizeIndex(v16)];
if( (_DWORD)v9 )
{
if( (_DWORD)v45 )
goto LABEL_11;
if( (unsigned __int8)CurrentIrql < 2u && MiCreateColorAnchors((INT64)v44, v6) )
{
HIDWORD(v44[1]) = Tree.Root;
LODWORD(v44[1]) = v17 == 0 ? 2 : 0;
LABEL_11:
v19 = (unsigned __int128)((v16 - (__int64)MmGetPfnDb()) * (__int128)0x2AAAAAAAAAAAAAABi64) >> 64;
v20 = v40;
MiInsertMdlPageNeedsZero((__int64)v44, ((unsigned __int64)v19 >> 63) + (v19 >> 3), v40);
v12 = 1;
v34 = 1;
goto LABEL_15;
}
MiZeroLargePage((_MI_ZERO_THREAD_CONTEXT *)v16);
}
v21 = v38;
if( *v38 != (CHAR *)&v37 )
__fastfail(3u);
v12 = v34;
*(_QWORD *)v16 = &v37;
*(_QWORD *)(v16 + 8) = v21;
*v21 = v16;
v38 = (CHAR **)v16;
v20 = v40;
LABEL_15:
v13 = (_MI_LARGEPAGE_MEMORY_INFO *)((char *)v13 + v20);
v16 = v18;
}
while( v18 );
v5 = v48;
v8 = v36;
v11 = Partition;
v10 = PreferredNodea;
}
while( (unsigned __int64)v13 < PreferredNode );
}
v22 = v37;
if( v37 != (CHAR *)&v37 )
{
v23 = v39;
do
{
v24 = *(CHAR ***)v22;
MiAssembleLargePagePfnList(v23, v22);
v22 = (CHAR *)v24;
}
while( v24 != &v37 );
LOBYTE(v5) = v48;
}
if( v12 )
{
MiZeroInParallel((_COLORED_PAGE_INFO *)v44, (UINT64)v22, v9);
v25 = v45;
v26 = 0;
if( (_DWORD)v45 )
{
v27 = v39;
v28 = (CHAR **)(v44[0] + 32);
do
{
v29 = *v28;
if( *v28 != (CHAR *)v28 )
{
do
{
v30 = *(CHAR **)v29;
MiAssembleLargePagePfnList(v27, v29);
v29 = v30;
}
while( v30 != (CHAR *)v28 );
v25 = v45;
}
v28 += 6;
++v26;
}
while( v26 < v25 );
LOBYTE(v5) = v48;
}
MiDeleteColorAnchors((INT64)v44);
}
if( v13 != (_MI_LARGEPAGE_MEMORY_INFO *)PreferredNode && (unsigned __int8)CurrentIrql < 2u && (v5 & 1) == 0 )
{
Tree.Root = 0i64;
LODWORD(ProtectionMaska) = v36;
MiFindLargePageMemory(
Partition,
(_MI_LARGEPAGE_MEMORY_INFO *)v6,
PreferredNode - (_QWORD)v13,
PreferredNodea,
ProtectionMaska);
}
return v13;
}Referenced by:
MiAllocateFastLargePagesForMdl
MiCreateLargePfnList
MiCreatePagingFileMap
MiGetLargePagesForSystemMapping