MiGetBaseResidentPageForBugCheck

_MMPFN *__fastcall MiGetBaseResidentPageForBugCheck(_MMPFN *a1){
  _MMPFN *PfnDb; 
  __int64 v2; 
  int v3; 
  int i; 
  __int64 v5; 

  PfnDb = MmGetPfnDb();
  v2 = a1 - PfnDb;
  v3 = 0;
  for( i = 2; ; --i )
  {
    v5 = MiLargePageSizes[i] - 1;
    if( (v5 & v2) != 0 )
    {
      v2 &= ~v5;
      a1 = &PfnDb[v2];
      if( (unsigned int)++v3 > 3 )
        return 0i64;
    }
    if( (a1->ViewCount & 3) != 0 )
      break;
    if( !i )
      return 0i64;
  }
  return a1;
}

Referenced by:

MiGetPagesRemainingInResidentPage
MiMirrorRemoveInactivePages