MmFreeIndependentPages

VOID __stdcall MmFreeIndependentPages(PVOID VirtualAddress, UINT64 a2){
  UINT64 v2; 
  MMPTE *PteAddress; 
  BOOL v4; 
  wchar_t *Buffer; 
  BOOL v6; 
  _MMPFN *PfnDb; 
  unsigned __int64 v8; 
  UINT8 v9; 
  WCHAR *v10; 
  UINT64 v11; 
  UINT64 v12; 
  INT64 v13; 
  UINT64 v14; 
  __int64 v15; 
  __int64 v16; 
  UINT64 v17; 
  __int128 v18; 
  UNICODE_STRING v19; 
  UINT64 v20; 
  v15 = 0i64;
  v16 = 0i64;
  v18 = 0i64;
  v2 = (a2 >> 12) + ((a2 & 0xFFF) != 0);
  v20 = v2;
  v14 = v2;
  v17 = v2;
  PteAddress = MiGetPteAddress(VirtualAddress);
  v13 = (INT64)PteAddress;
  v19.Buffer = (wchar_t *)((char *)PteAddress + 8 * v2);
  v4 = MiPteInShadowRange((UINT64)&v19);
  Buffer = v19.Buffer;
  v6 = v4;
  PfnDb = MmGetPfnDb();
  do
  {
    v8 = MI_READ_PTE_LOCK_FREE((INT64)PteAddress);
    *(_QWORD *)&v19.Length = v8;
    if( v6 )
      v8 = MiReadPteShadow(&v19, (UNICODE_STRING *)v8, v9, v10);
    v11 = (UINT64)PfnDb + 48 * ((v8 >> 12) & 0xFFFFFFFFFi64);
    v12 = (UINT64)PfnDb + 48 * (*(_QWORD *)(v11 + 40) & 0xFFFFFFFFFi64);
    *(_QWORD *)PteAddress = ZeroPte;
    if( MiIsPfnFromSlabAllocation(v11) )
    {
      --v14;
      --v17;
      MiLockAndDecrementShareCount(v11, 1);
    }
    else if( (unsigned int)MiLockAndDecrementShareCount(v11, 1) == 3 )
    {
      ++v15;
    }
    MiLockAndDecrementShareCount(v12, 0);
    PteAddress = (MMPTE *)((char *)PteAddress + 8);
    PfnDb = MmGetPfnDb();
  }
  while( PteAddress < (MMPTE *)Buffer );
  MiReleasePtes((INT64)&qword_140C4EC80, v13, v20);
  MiReturnPoolCharges(&v14, 1i64);
}

Referenced by:

ExDeletePoolTagTable
HvlDeleteProcessor
HvlStartBootLogicalProcessors
HvlpInitializeHvCrashdump
IopLiveDumpAllocateDumpBuffers
IopLiveDumpFreeDumpBuffers
IopLiveDumpReleaseResources
IopLiveDumpWriteDumpFile
IopLiveDumpWriteDumpFileWithExtraPages
KeAllocateProcessorProfileStructures
KeStartAllProcessors
KiStartDynamicProcessor
MmFreeIsrStack