MiCheckPurgeAndUpMapCount

__int64 __fastcall MiCheckPurgeAndUpMapCount(__int64 a1){
  volatile LONG *v1; 
  KIRQL i; 
  __int64 result; 
  __int128 v5; 
  __int128 PcValue; 
  __int64 v7; 
  v1 = (volatile LONG *)(a1 + 72);
  v7 = 0i64;
  v5 = 0i64;
  PcValue = 0i64;
  for( i = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)(a1 + 72));
        (*(_DWORD *)(a1 + 56) & 4) != 0;
        i = ExAcquireSpinLockExclusive(v1) )
  {
    DWORD1(PcValue) = 0;
    v7 = (__int64)&PcValue + 8;
    DWORD2(v5) = 2;
    *((_QWORD *)&PcValue + 1) = (char *)&PcValue + 8;
    *(_QWORD *)&v5 = *(_QWORD *)(a1 + 80);
    *(_QWORD *)(a1 + 80) = &v5;
    LOWORD(PcValue) = 263;
    BYTE2(PcValue) = 6;
    ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)v1);
    __writecr8(i);
    KeWaitForGate(&PcValue, 18);
  }
  ++*(_QWORD *)(a1 + 40);
  ++*(_QWORD *)(a1 + 48);
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)v1);
  result = i;
  __writecr8(i);
  return result;
}

Referenced by:

MiApplyHotPatchToLoadedDriver
MiMapViewInSystemSpace
MiMapViewOfDataSection
MiMapViewOfImageSection
MmLoadSystemImageEx