MiZeroPageWorkMapping

VOID __stdcall MiZeroPageWorkMapping(UINT64 LargePageIndex, MMPTE *PointerPte){
  char v2; 
  char v3; 
  __int64 v4; 
  INT64 v6; 
  INT64 v7; 
  int v8; 
  unsigned __int64 PteBase; 
  unsigned __int64 v10; 
  __int64 v11; 
  MMPTE *j; 
  UINT64 i; 
  __int64 v14; 
  INT64 result; 
  int v16; 
  __int64 v17; 
  v3 = v2;
  v4 = (unsigned int)LargePageIndex;
  memset((INT64)&result, 0i64);
  v16 = 20;
  v6 = 0i64;
  v17 = 0i64;
  v7 = 1i64;
  v8 = 1;
  if( (unsigned int)v4 <= 1 )
  {
    MiInsertLargeTbFlushEntry((INT64)&result, (unsigned int)(2 - v4), (INT64)PointerPte);
    v7 = 1i64;
    v6 = 1i64;
  }
  PteBase = (unsigned __int64)MmGetPteBase();
  if( (v3 & 2) != 0 )
  {
    for( i = (UINT64)PointerPte; i >= PteBase; i = (__int64)((i << 25) - (PteBase << 25)) >> 16 )
    {
      if( i > (unsigned __int64)MmGetPteLimit() )
        break;
    }
    if( MiVaIsUltra(i) )
    {
      v8 = 0;
    }
    else if( (unsigned int)v4 > (unsigned int)v7 )
    {
      v8 = 0;
    }
  }
  if( !v6 )
  {
    v10 = PteBase << 25;
    v11 = (__int64)(((_QWORD)PointerPte << 25) - (PteBase << 25)) >> 16;
    if( (_DWORD)v4 == 3 )
    {
      v6 = v7;
LABEL_7:
      MiInsertTbFlushEntry((INT64)&result, v11, v7, 0i64);
      goto LABEL_8;
    }
    v6 = MiLargePageSizes[v4];
    if( (_DWORD)v4 == 2 )
    {
      v7 = MiLargePageSizes[v4];
      goto LABEL_7;
    }
    if( (unsigned int)v4 <= (unsigned int)v7 )
    {
      v14 = (unsigned int)(2 - v4);
      do
      {
        MiInsertTbFlushEntry((INT64)&result, v11, v6, 0i64);
        v6 <<= 9;
        v11 = (__int64)((v11 << 25) - v10) >> 16;
        --v14;
      }
      while( v14 );
    }
    v6 = 512i64;
  }
LABEL_8:
  for( j = (MMPTE *)((char *)PointerPte + 8 * v6); PointerPte < j; PointerPte = (MMPTE *)((char *)PointerPte + 8) )
    *(_QWORD *)PointerPte = 0i64;
  if( v8 )
    MiFlushTbList((__int64)&result);
}

Referenced by:

MiPageListCollision
MiReleaseLargeZeroingVa