MiGetPagesRemainingInResidentPage

NTSTATUS __stdcall MiGetPagesRemainingInResidentPage(INT64 a1, INT64 *rdx0, INT64 *r8_0){
  INT64 v6; 
  _MMPFN *v7; 
  NTSTATUS PfnPageSizeIndex; 
  unsigned int v9; 
  int v10; 
  int v11; 
  __int64 v12; 
  INT64 a2; 
  INT64 a3; 

  LODWORD(a2) = 0;
  LODWORD(a3) = 0;
  v6 = (a1 - (__int64)MmGetPfnDb()) / 48;
  if( (KiBugCheckActive & 3) != 0 )
  {
    v7 = MiGetBaseResidentPageForBugCheck((_MMPFN *)a1);
    if( v7 )
    {
      PfnPageSizeIndex = MiGetPfnPageSizeIndex((INT64)v7);
    }
    else
    {
      v9 = *(unsigned __int8 *)(a1 + 34);
      PfnPageSizeIndex = 3;
    }
    v10 = v9 >> 6;
    v11 = v9 & 7;
  }
  else
  {
    PfnPageSizeIndex = MiGetPfnPageSizeIndexUnsynchronized((_MMPFN *)a1, &a2, &a3);
    v11 = a2;
    v10 = a3;
  }
  if( PfnPageSizeIndex == 3 )
    LODWORD(v12) = 1;
  else
    v12 = MiLargePageSizes[PfnPageSizeIndex];
  *(_DWORD *)rdx0 = v11;
  *(_DWORD *)r8_0 = v10;
  return v12 + (v6 & ~(v12 - 1)) - v6;
}

Referenced by:

MiAddPhysicalPagesToCrashDump