MiScrubProcessPhysicalPages

VOID __stdcall MiScrubProcessPhysicalPages(VOID *OpaqueParameter){
  _ETHREAD *CurrentThread; 
  _EPROCESS *Process; 
  _MMWSL_INSTANCE *VmWorkingSetList; 
  INT64 LockedEntries; 
  unsigned __int64 v6; 
  unsigned __int64 v7; 
  UINT64 v8; 
  INT64 v9; 
  int v10; 
  UINT64 SetBits; 
  unsigned __int64 v12; 
  __int64 v13; 
  _MMPFN *v14; 
  unsigned __int64 i; 
  UINT8 v16; 
  unsigned __int64 v17; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  Process = CurrentThread->Tcb.ApcState.Process;
  MiLockAweVadsExclusive((INT64)CurrentThread);
  VmWorkingSetList = Process->Vm.Instance.VmWorkingSetList;
  LockedEntries = VmWorkingSetList[9].LockedEntries;
  if( LockedEntries )
  {
    ExGetCallBackBlockRoutine((_EX_CALLBACK_ROUTINE_BLOCK *)VmWorkingSetList[9].LockedEntries);
    v17 = v6;
    v7 = v6;
    v8 = 0i64;
    MiLockAwePagesExclusive(v9, (INT64)CurrentThread);
    LOBYTE(v10) = MiScrubInterrupted((INT64)OpaqueParameter);
    while( !v10 )
    {
      SetBits = RtlFindSetBitsEx((_RTL_BITMAP_EX *)(LockedEntries + 16), 1ui64, v8);
      v12 = SetBits;
      if( SetBits < v8 || SetBits == -1i64 )
        break;
      v13 = SetBits * v7;
      v14 = &MmGetPfnDb()[v13];
      for( i = 0i64; i < v17; ++i )
      {
        if( MiScrubAwePage(OpaqueParameter, v13, (_DWORD *)LockedEntries) < 0 )
          MiMakePageBad(v14, 1ui64, v16);
        MiUnlockAwePagesExclusive(LockedEntries, (INT64)CurrentThread);
        MiUnlockAweVadsExclusive(&CurrentThread->Tcb);
        ++v13;
        ++v14;
        MiLockAweVadsExclusive((INT64)CurrentThread);
        MiLockAwePagesExclusive(LockedEntries, (INT64)CurrentThread);
        if( !_bittest64(*(const signed __int64 **)(LockedEntries + 24), v12) )
          break;
      }
      v8 = v12 + 1;
      if( v12 + 1 >= *(_QWORD *)(LockedEntries + 16) )
        break;
      LOBYTE(v10) = MiScrubInterrupted((INT64)OpaqueParameter);
      v7 = v17;
    }
    MiUnlockAwePagesExclusive(LockedEntries, (INT64)CurrentThread);
  }
  MiUnlockAweVadsExclusive(&CurrentThread->Tcb);
}

Referenced by:

MiScrubProcesses