MiUnlockDriverPages

VOID __stdcall MiUnlockDriverPages(UINT64 *a1){
  UINT64 v2; 
  _MMPTE *PteAddress; 
  UINT64 v4; 
  UINT64 SetBits; 
  unsigned __int64 v6; 
  void *v7; 

  if( a1[4] )
  {
    v2 = *a1;
    if( (a1[7] & 1) != 0 )
      KeReservePrivilegedPages(0);
    PteAddress = MiGetPteAddress(*(VOID **)(v2 + 48));
    v4 = 0i64;
    while( 1 )
    {
      SetBits = RtlFindSetBitsEx((_RTL_BITMAP_EX *)(a1 + 3), 1ui64, v4);
      v6 = SetBits;
      if( SetBits == -1i64 )
        break;
      MiUnlockCodePage(&PteAddress[SetBits], &PteAddress[SetBits]);
      v4 = v6;
      _bittestandreset64((signed __int64 *)a1[4], v6);
    }
    ExFreePoolWithTag((PVOID)a1[4], 0);
    a1[4] = 0i64;
    v7 = (void *)a1[6];
    if( v7 )
    {
      ExFreePoolWithTag(v7, 0);
      a1[6] = 0i64;
    }
  }
}

Referenced by:

MiApplyDriverHotPatch
MiMarkKernelImageCfgBits
MiUnapplyDriverHotPatch
MiUnlockEntireDriver
MmWriteSystemImageTracepoint