MiFillGapPtes

VOID __stdcall MiFillGapPtes(
        _MMPTE *PointerPxe,
        _MMPTE *EndPxe,
        _MI_PTE_RANGE *PteHierarchy,
        UINT64 *GapFrames,
        UINT64 PagingLevel){
  UINT64 v5; 
  _MMPTE *v6; 
  char v9; 
  _XSTATE_CONFIGURATION *v10; 
  __int64 v11; 
  __int64 v12; 
  int v13; 
  _MMPTE *v14; 
  UINT64 v15; 

  v5 = (UINT64)PointerPxe;
  v6 = EndPxe;
  if( (unsigned __int64)PointerPxe < *(_QWORD *)&PteHierarchy[4 * (int)PagingLevel] )
    v5 = *(_QWORD *)&PteHierarchy[4 * (int)PagingLevel];
  if( (unsigned __int64)EndPxe > *(_QWORD *)&PteHierarchy[4 * (int)PagingLevel + 2] )
    v6 = *(_MMPTE **)&PteHierarchy[4 * (int)PagingLevel + 2];
  for( ; v5 <= (unsigned __int64)v6; v5 += 8i64 )
  {
    v9 = MI_READ_PTE_LOCK_FREE(v5);
    if( (v9 & 1) != 0 )
    {
      if( (_DWORD)PagingLevel && v9 >= 0 )
      {
        v14 = (_MMPTE *)((__int64)((v5 << 25) - ((_QWORD)MmGetPteBase() << 25)) >> 16);
        LODWORD(v15) = PagingLevel - 1;
        MiFillGapPtes(v14, v14 + 511, PteHierarchy, GapFrames, v15);
      }
    }
    else
    {
      v10 = (_XSTATE_CONFIGURATION *)v5;
      if( (_DWORD)PagingLevel )
        v10 = 0i64;
      LODWORD(v11) = MiMakeValidPte(
                       v10,
                       GapFrames[(int)PagingLevel],
                       (_DWORD)PagingLevel != 0 ? -1476395004 : 536870913);
      v12 = v11;
      LOBYTE(v13) = MiPteInShadowRange(v5);
      if( v13 && (KeGetCurrentThread()->ApcState.Process->Flags3 & 0x1000) != 0 && (v12 & 1) != 0 )
        v12 |= 0x8000000000000000ui64;
      *(_QWORD *)v5 = v12;
    }
  }
}

Referenced by:

MiFillGapAddresses
MiFillGapPtes