MiZeroAndConvertPage

NTSTATUS __stdcall MiZeroAndConvertPage(_MI_ZERO_THREAD_CONTEXT *ThreadContext, UINT64 a2, INT64 a3, CHAR a4){
  __int64 v4; 
  int v6; 
  INT64 v7; 
  signed __int64 v8; 
  _BOOL4 v9; 
  int v10; 
  _BOOL4 v11; 
  NTSTATUS result; 

  v4 = (int)a3;
  v6 = a2;
  v7 = 1i64;
  v8 = ((char *)ThreadContext - (char *)MmGetPfnDb()) / 48;
  v9 = (a4 & 1) != 0 || (a4 & 2) != 0 && (ThreadContext[4] & 0x3E0i64) != 0;
  v10 = *((unsigned __int8 *)ThreadContext + 34) >> 6;
  if( (_DWORD)a2 != 3 )
    v7 = MiLargePageSizes[(unsigned int)a2];
  v11 = v10 != v4;
  if( v9 )
  {
    if( v10 != (_DWORD)v4
      && *((_DWORD *)&stru_140C4DB30 + 4 * ((unsigned __int64)*((unsigned __int8 *)ThreadContext + 34) >> 6) + v4 + 106) == (_DWORD)v4 )
    {
      MiChangePageAttributeContiguous(v8, v7, (unsigned int)v4);
      v11 = 0;
    }
    if( v6 == 3 )
      MiZeroPhysicalPage(v8, 0i64, (_MI_PFN_CACHE_ATTRIBUTE)v4);
    else
      MiZeroLargePage(ThreadContext);
  }
  if( v11 )
    MiChangePageAttributeContiguous(v8, v7, (unsigned int)v4);
  result = ZeroPte.u.Long;
  *((_MMPTE *)ThreadContext + 2) = ZeroPte;
  return result;
}

Referenced by:

MiInitializeMdlOneNodeBatchPages
MiZeroInParallelWorker