MiWakePageZeroing

NTSTATUS __stdcall MiWakePageZeroing(INT64 a1, UINT64 a2, UINT8 *a3){
  unsigned __int8 CurrentIrql; 
  UINT64 v6; 
  UINT64 v7; 
  NTSTATUS result; 
  _BYTE *i; 
  unsigned __int64 v10; 
  unsigned __int64 v11; 
  INT64 v12; 
  _KLOCK_QUEUE_HANDLE LockHandle; 

  CurrentIrql = 17;
  memset(&LockHandle, 0, sizeof(LockHandle));
  if( a2 )
  {
    result = *(_DWORD *)(a1 + 4);
    if( (result & 0x40) != 0 )
      return result;
    v6 = a2;
    v7 = a2 + 4544;
  }
  else
  {
    v6 = *(_QWORD *)(a1 + 16);
    v7 = v6 + 4544i64 * (unsigned __int16)KeNumberNodes;
  }
  result = *(_DWORD *)(a1 + 6340);
  if( !result && v6 < v7 )
  {
    for( i = (_BYTE *)(v6 + 4490); (unsigned __int64)(i - 4490) < v7; i += 4544 )
    {
      if( !*i )
      {
        if( !a2 )
        {
          CurrentIrql = KeGetCurrentIrql();
          __writecr8(2ui64);
LABEL_14:
          if( *(_BYTE *)(a1 + 6297) )
          {
            v12 = *(_QWORD *)(i - 58);
            KeAcquireInStackQueuedSpinLock((PKSPIN_LOCK)(v12 + 24), &LockHandle);
            if( !*i )
            {
              *i = 1;
              MiWakeZeroingThreads(v12, 2);
            }
            KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle);
            __writecr8(LockHandle.OldIrql);
          }
          else
          {
            LockHandle.LockQueue.Next = 0i64;
            LockHandle.LockQueue.Lock = (unsigned __int64 *volatile)(a1 + 4928);
            KxAcquireQueuedSpinLock(&LockHandle.LockQueue, (UINT64 *)(a1 + 4928));
            if( !*i )
            {
              *i = 1;
              KeSetEvent((PRKEVENT)(a1 + 6272), 0, 0);
            }
            KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle);
          }
          if( !a2 )
            __writecr8(CurrentIrql);
          goto LABEL_23;
        }
        LODWORD(v10) = MiNodeLargeFreeZeroPages((_MI_NODE_INFORMATION *)(i - 4490), 4ui64, FreePageList);
        if( v10 >= 0x400 )
        {
          LODWORD(v11) = MiNodeLargeFreeZeroPages((_MI_NODE_INFORMATION *)(i - 4490), 4ui64, ZeroedPageList);
          if( v11 < 0x100000 )
            goto LABEL_14;
        }
      }
LABEL_23:
      result = 2;
    }
  }
  return result;
}

Referenced by:

MiInsertLargePageInNodeList
MiWorkingSetManager