MiIsRegularMemory

UINT64 __fastcall MiIsRegularMemory(_LOADER_PARAMETER_BLOCK *LoaderBlock, UINT64 PageFrameIndex){
  char *v2; 
  __int64 v3; 
  UINT64 v4; 
  UINT64 v6; 
  UINT64 v7; 
  unsigned __int64 v8; 
  __int64 v9; 
  v2 = (char *)LoaderBlock + 32;
  v3 = *((_QWORD *)LoaderBlock + 4);
  if( MxPfnMemoryDescriptorCache )
  {
    v4 = *(_QWORD *)(MxPfnMemoryDescriptorCache + 24);
    if( PageFrameIndex >= v4 )
    {
      if( PageFrameIndex < *(_QWORD *)(MxPfnMemoryDescriptorCache + 32) + v4 )
        return 1i64;
      v3 = *(_QWORD *)MxPfnMemoryDescriptorCache;
    }
  }
  if( !MxNonPfnMemoryDescriptorCache )
    goto LABEL_14;
  v6 = *(_QWORD *)(MxNonPfnMemoryDescriptorCache + 24);
  if( PageFrameIndex < v6 )
    goto LABEL_14;
  if( PageFrameIndex >= v6 + *(_QWORD *)(MxNonPfnMemoryDescriptorCache + 32) )
  {
    if( v6 > *(_QWORD *)(v3 + 24) )
      v3 = *(_QWORD *)MxNonPfnMemoryDescriptorCache;
LABEL_14:
    while( (char *)v3 != v2 )
    {
      v7 = *(_QWORD *)(v3 + 24);
      if( PageFrameIndex < v7 )
        break;
      if( PageFrameIndex < *(_QWORD *)(v3 + 32) + v7 )
      {
        v8 = *(_DWORD *)(v3 + 16) & 0x3FFFFFFF;
        if( (unsigned int)v8 > 0x28 || (v9 = 0x1C5C0C00048i64, !_bittest64(&v9, v8)) )
        {
          MxPfnMemoryDescriptorCache = v3;
          return 1i64;
        }
        MxNonPfnMemoryDescriptorCache = v3;
        return 0i64;
      }
      v3 = *(_QWORD *)v3;
    }
  }
  return 0i64;
}

Referenced by:

MxCreatePfns
MxMovePageTables