ExpAcquireSpinLockExclusive

UINT64 __stdcall ExpAcquireSpinLockExclusive(INT64 *SpinLock, UINT8 OldIrql){
  unsigned int v3; 
  signed __int32 v4; 
  bool v6; 
  signed __int32 v7; 

  v3 = 0;
  if( _interlockedbittestandset((volatile signed __int32 *)SpinLock, 0x1Fu) )
    v3 = ExpWaitForSpinLockExclusiveAndAcquire(SpinLock, OldIrql);
  v4 = *(_DWORD *)SpinLock;
  while( (v4 & 0xBFFFFFFF) != 0x80000000 )
  {
    if( (v4 & 0x40000000) == 0 )
    {
      v7 = _InterlockedCompareExchange((volatile signed __int32 *)SpinLock, v4 | 0x40000000, v4);
      v6 = v4 == v7;
      v4 = v7;
      if( !v6 )
        continue;
    }
    ++v3;
    _mm_pause();
    v4 = *(_DWORD *)SpinLock;
  }
  return v3;
}

Referenced by:

ExInitializeResourceLite
ExpAcquireSpinLockExclusiveAtDpcLevelInstrumented
MiAddViewsForSection
MiDeleteVad
MiDereferenceControlAreaPfnList
MiFinishVadDeletion
MiGetVadWakeList
MiInsertVad
MiReferencePageRuns
MiZeroLargePageThread
MmDoesFileHaveUserWritableReferences
PsImpersonateContainerOfThread
PspRevertContainerImpersonation
RtlpHpAcquireQueuedLockExclusive
RtlpHpSegPageRangeAllocate
RtlpHpSegPageRangeShrink
RtlpHpVsChunkSplit
RtlpHpVsSubsegmentCommitPages