MiZeroInParallel
VOID __stdcall MiZeroInParallel(_COLORED_PAGE_INFO *ColoredPageInfoBase, UINT64 SecondaryColors, UINT64 Flags){
unsigned int v3;
unsigned int v4;
__int64 v5;
_ETHREAD *CurrentThread;
unsigned int v7;
__int128 v8;
unsigned __int64 v9;
__int64 v10;
unsigned __int8 v11;
unsigned __int64 v12;
KPRIORITY v13;
int v14;
__int128 v15;
__int64 v16;
__int64 Context[2];
__int16 v18;
char v19;
char v20;
int v21;
__int64 v22[3];
void *ThreadHandle;
ThreadHandle = 0i64;
v3 = 0;
Context[0] = 0i64;
v4 = ColoredPageInfoBase[4];
v5 = *(_QWORD *)ColoredPageInfoBase;
v20 = 0;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
v7 = *(&stru_140C4DB30 + 61);
v8 = *((_OWORD *)ColoredPageInfoBase + 2);
v16 = *((_QWORD *)&v8 + 1);
if( v4 )
{
v9 = v8;
v10 = v4;
do
{
if( *(_QWORD *)(v5 + 32) == v5 + 32 )
{
*(_DWORD *)v5 = 1;
}
else
{
*(_DWORD *)v5 = 0;
++v3;
if( v9 )
{
Flags = 0i64;
*((_QWORD *)&v15 + 1) = *((_QWORD *)&v8 + 1);
v11 = 0;
*(_QWORD *)&v15 = 0i64;
if( v7 )
{
do
{
_BitScanForward64(&v12, v9);
Flags |= 1i64 << v12;
v9 &= ~Flags;
if( !v9 )
break;
++v11;
}
while( v11 < v7 );
*((_QWORD *)&v8 + 1) = v16;
*(_QWORD *)&v15 = Flags;
}
*(_OWORD *)(v5 + 8) = v15;
}
else
{
*(_QWORD *)(v5 + 8) = 0i64;
}
}
v5 += 48i64;
--v10;
}
while( v10 );
}
if( v3 == 1
|| (ColoredPageInfoBase[2] & 4) != 0
|| (CurrentThread->Tcb._bf_0 & 0x400) != 0
|| KeGetCurrentIrql() == 2
|| (MiFlags & 0x30) == 0 )
{
v3 = 0;
}
v21 = 0;
v22[1] = (__int64)v22;
v22[0] = (__int64)v22;
Context[1] = (__int64)ColoredPageInfoBase;
v18 = 263;
v19 = 6;
HIDWORD(Context[0]) = v3;
if( v3 )
v13 = KeSetPriorityThread(&CurrentThread->Tcb, 15);
else
v13 = -1;
v14 = 0;
LODWORD(Context[0]) = v13;
if( v3 )
{
while( PsCreateSystemThread(&ThreadHandle, 0x1FFFFFu, 0i64, 0, 0i64, MiZeroInParallelWorker, Context) >= 0 )
{
ObCloseHandle(ThreadHandle, 0);
if( ++v14 >= v3 )
goto LABEL_28;
}
v3 -= v14;
if( _InterlockedExchangeAdd((volatile signed __int32 *)Context + 1, -v3) == v3 )
KeSignalGate((_KGATE *)&v18, 1i64);
LABEL_28:
if( v3 )
KeSetPriorityThread(&CurrentThread->Tcb, v13);
}
if( v14 )
KeWaitForGate((_KGATE *)&v18, Executive, Flags);
else
MiZeroInParallelWorker(Context);
}Referenced by:
MiAllocateLargeZeroPages
MiFindLargePageMemory
MiInitializeMdlOneNodeBatchPages