MiScrubPage

INT64 __fastcall MiScrubPage(UINT64 *a1, INT64 a2, UINT64 a3, CHAR a4){
  UINT64 UltraMapping; 
  UINT64 *v9; 
  int ProtectionPfnCompatible; 
  void *v11; 
  unsigned int v12; 
  if( a3 )
  {
    UltraMapping = a3;
    v9 = 0i64;
  }
  else
  {
    UltraMapping = MiGetUltraMapping(a1 + 18, 3u, 1i64, 0);
    v9 = (UINT64 *)((char *)MmGetPteBase() + ((UltraMapping >> 9) & 0x7FFFFFFFF8i64));
    ProtectionPfnCompatible = MiMakeProtectionPfnCompatible(4ui64, (_MMPFN *)a2);
    *v9 = MiMakeValidPte((UINT64)v9, (a2 - (__int64)MmGetPfnDb()) / 48, ProtectionPfnCompatible | 0xA0000000);
  }
  if( (a4 & 1) != 0 )
  {
    v11 = (void *)a1[25];
    KeCopyPage(v11);
  }
  else
  {
    v11 = 0i64;
  }
  v12 = RtlScrubMemory((PVOID)UltraMapping);
  if( v11 )
    KeCopyPage((PVOID)UltraMapping);
  if( !a3 )
    *v9 = ZeroPte;
  ++a1[26];
  return v12;
}

Referenced by:

MiScrubAwePage
MiScrubLargeMappedPage
MiScrubNode
MiScrubNodeLargePageList