MiIsRegularMemory

NTSTATUS __stdcall MiIsRegularMemory(_LOADER_PARAMETER_BLOCK *LoaderBlock, UINT64 PageFrameIndex){
  _LIST_ENTRY *p_MemoryDescriptorListHead; 
  _LIST_ENTRY *Flink; 
  UINT64 v4; 
  UINT64 v6; 
  UINT64 Blink; 
  unsigned __int64 v8; 
  __int64 v9; 

  p_MemoryDescriptorListHead = &LoaderBlock->MemoryDescriptorListHead;
  Flink = LoaderBlock->MemoryDescriptorListHead.Flink;
  if( MxPfnMemoryDescriptorCache )
  {
    v4 = *(_QWORD *)(MxPfnMemoryDescriptorCache + 24);
    if( PageFrameIndex >= v4 )
    {
      if( PageFrameIndex < *(_QWORD *)(MxPfnMemoryDescriptorCache + 32) + v4 )
        return 1;
      Flink = *(_LIST_ENTRY **)MxPfnMemoryDescriptorCache;
    }
  }
  if( !MxNonPfnMemoryDescriptorCache )
    goto LABEL_14;
  v6 = *(_QWORD *)(MxNonPfnMemoryDescriptorCache + 24);
  if( PageFrameIndex < v6 )
    goto LABEL_14;
  if( PageFrameIndex >= v6 + *(_QWORD *)(MxNonPfnMemoryDescriptorCache + 32) )
  {
    if( (_LIST_ENTRY *)v6 > Flink[1].Blink )
      Flink = *(_LIST_ENTRY **)MxNonPfnMemoryDescriptorCache;
LABEL_14:
    while( Flink != p_MemoryDescriptorListHead )
    {
      Blink = (UINT64)Flink[1].Blink;
      if( PageFrameIndex < Blink )
        break;
      if( (_LIST_ENTRY *)PageFrameIndex < (_LIST_ENTRY *)((char *)Flink[2].Flink + Blink) )
      {
        v8 = (__int64)Flink[1].Flink & 0x3FFFFFFF;
        if( (unsigned int)v8 > 0x28 || (v9 = 0x1C5C0C00048i64, !_bittest64(&v9, v8)) )
        {
          MxPfnMemoryDescriptorCache = (__int64)Flink;
          return 1;
        }
        MxNonPfnMemoryDescriptorCache = (__int64)Flink;
        return 0;
      }
      Flink = Flink->Flink;
    }
  }
  return 0;
}

Referenced by:

MxCreatePfns
MxMovePageTables