ExpWaitForSpinLockExclusiveAndAcquire

UINT64 __stdcall ExpWaitForSpinLockExclusiveAndAcquire(INT64 *SpinLock, UINT8 OldIrql){
  unsigned int v2; 
  signed __int32 v4; 
  signed __int32 v6; 

  v2 = 0;
  do
  {
    v4 = *(_DWORD *)SpinLock;
    while( v4 < 0 )
    {
      if( (v4 & 0x40000000) == 0 )
      {
        v6 = v4;
        v4 = _InterlockedCompareExchange((volatile signed __int32 *)SpinLock, v4 | 0x40000000, v4);
        if( v6 != v4 )
          continue;
      }
      if( OldIrql != 0xFF )
        __writecr8(OldIrql);
      ++v2;
      _mm_pause();
      if( OldIrql != 0xFF )
      {
        OldIrql = KeGetCurrentIrql();
        __writecr8(2ui64);
      }
      v4 = *(_DWORD *)SpinLock;
    }
  }
  while( _interlockedbittestandset((volatile signed __int32 *)SpinLock, 0x1Fu) );
  return v2;
}

Referenced by:

CcGetPartition
CcGetVirtualAddress
CcSetDirtyPinnedData
CcUnpinFileDataEx
ExAcquireSpinLockExclusive
ExAcquireSpinLockExclusiveAtDpcLevel
ExDeleteResourceLite
ExpAcquireSpinLockExclusive
MiIdentifyPfn
MiMakePageAvoidRead
MiPfPutPagesInTransition
MiZeroLargePages
MiZeroPage
MmGetControlAreaPartition