MiExceptionForMappedVa

NTSTATUS __stdcall MiExceptionForMappedVa(VOID *VirtualAddress){
  VOID *v1; 
  NTSTATUS v2; 
  _MMSESSION *v4; 
  _EPROCESS *Process; 
  _MMSUPPORT_INSTANCE *i; 
  _MMSUPPORT_INSTANCE *v7; 
  char v8; 
  UINT64 Root; 
  unsigned __int64 v10; 
  INT64 v11; 
  INT16 v12; 
  INT64 Session; 
  unsigned int v14; 

  v2 = 0;
  v4 = &::Session;
  Process = KeGetCurrentThread()->ApcState.Process;
  for( i = MiGetAnyMultiplexedVm(MiWorkingSetTypeSystemViews, v1); ; i = MiGetSessionVm(Session, v11, v12) )
  {
    v7 = i;
    MiLockWorkingSetShared();
    Root = (UINT64)v4->ViewRoot.Root;
    while( Root )
    {
      v10 = *(_QWORD *)(Root + 88) & 0xFFFFFFFFFFFFF000ui64;
      if( (unsigned __int64)VirtualAddress >= v10 + *(_QWORD *)(Root + 32) )
      {
        Root = *(_QWORD *)(Root + 8);
      }
      else
      {
        if( (unsigned __int64)VirtualAddress >= v10 )
        {
          v14 = *(_DWORD *)(Root + 56);
          LOBYTE(Root) = v8;
          MiUnlockWorkingSetShared(v7, Root);
          return(v14 >> 1) & 1;
        }
        Root = *(_QWORD *)Root;
      }
    }
    LOBYTE(Root) = v8;
    MiUnlockWorkingSetShared(v7, Root);
    if( v4 != &::Session )
      break;
    Session = (INT64)Process->Session;
    if( !Session || (Process->Flags3 & 0x1000) != 0 )
      break;
    v4 = (_MMSESSION *)(Session + 192);
  }
  return v2;
}

Referenced by:

MiWaitForInPageComplete