MiFreeLargePages

VOID __fastcall MiFreeLargePages(_MMPFN *PfnAllocation){
  _QWORD *v1; 
  _MMPFN *v2; 
  _QWORD *v3; 
  INT64 v4; 
  __int64 v5; 
  INT64 v6; 
  UINT64 LeafPfnBuddy; 
  INT64 v8; 
  unsigned int PfnPageSizeIndex; 
  __int64 v10; 
  v2 = PfnAllocation;
  v3 = v1;
  v4 = 0i64;
  v5 = 0i64;
  v6 = *(_QWORD *)(qword_140C4E388 + 8 * ((*((_QWORD *)PfnAllocation + 5) >> 39) & 0x3FFi64));
  do
  {
    LeafPfnBuddy = MiGetLeafPfnBuddy(v2);
    PfnPageSizeIndex = MiGetPfnPageSizeIndex(v8);
    v4 += MiLargePageSizes[PfnPageSizeIndex];
    v5 += MiFreeLargePageMemory((v10 - (__int64)MmGetPfnDb()) / 48, PfnPageSizeIndex, 8ui64);
    v2 = (_MMPFN *)LeafPfnBuddy;
  }
  while( LeafPfnBuddy );
  if( v4 )
    MiFreeLargePageCrossPartitionCharges(v6, v4);
  *v3 = v5;
}

Referenced by:

MiDecommitRegion
MiDeletePagablePteRange
MiDeleteSubsectionLargePages