PerfLogSpinLockRelease

VOID __stdcall PerfLogSpinLockRelease(VOID *SpinLockAddress, VOID *CallerAddress, UINT64 ReleaseTime){
  struct _KPRCB *CurrentPrcb; 
  __int64 v7; 
  char v8; 
  unsigned __int8 v9; 
  struct _KPRCB *v10; 
  __int64 v11; 
  unsigned int v12; 
  unsigned __int8 NestingLevel; 
  unsigned __int8 CurrentIrql; 
  char v15; 
  char v16; 
  unsigned __int8 v17; 
  __int64 v18; 
  __int128 v19; 
  __int128 v20; 
  __int128 v21; 
  __int128 v22; 
  __int64 v23; 
  __int128 *v24; 
  int v25; 
  int v26; 

  v20 = 0i64;
  v23 = 0i64;
  v21 = 0i64;
  v22 = 0i64;
  CurrentPrcb = KeGetCurrentPrcb();
  v7 = (__int64)CurrentPrcb->EtwSupport + 16;
  v8 = *((_BYTE *)CurrentPrcb->EtwSupport + 272);
  if( v8 )
  {
    v9 = *((_BYTE *)CurrentPrcb->EtwSupport + 272);
    while( *(VOID **)(32i64 * --v9 + v7 + 8) != SpinLockAddress )
    {
      if( !v9 )
      {
        ++*((_DWORD *)CurrentPrcb->EtwSupport + 70);
        return;
      }
    }
    v10 = KeGetCurrentPrcb();
    v11 = 32i64 * v9 + v7;
    if( *((_BYTE *)CurrentPrcb->EtwSupport + 273) )
      goto LABEL_20;
    if( !EtwpSpinLockHoldThreshold || (int)ReleaseTime - *(_DWORD *)v11 <= (unsigned int)EtwpSpinLockHoldThreshold )
    {
      v12 = *(_DWORD *)(v11 + 20);
      if( (v12 < EtwpSpinLockSpinThreshold
         || v10->SynchCounters.SpinLockContentionCount % EtwpSpinLockContentionSampleRate)
        && (v12
         || (v10->SynchCounters.SpinLockAcquireCount - v10->SynchCounters.SpinLockContentionCount)
          % EtwpSpinLockAcquireSampleRate) )
      {
        goto LABEL_20;
      }
    }
    NestingLevel = v10->NestingLevel;
    *((_BYTE *)CurrentPrcb->EtwSupport + 273) = 1;
    *(_QWORD *)&v20 = SpinLockAddress;
    *((_QWORD *)&v20 + 1) = CallerAddress;
    *((_QWORD *)&v21 + 1) = ReleaseTime;
    DWORD2(v22) = KeGetCurrentThread()[1].CurrentRunTime;
    BYTE1(v23) = v8;
    CurrentIrql = KeGetCurrentIrql();
    LOBYTE(v23) = CurrentIrql;
    *(_QWORD *)&v21 = *(_QWORD *)v11;
    *(_QWORD *)&v22 = *(_QWORD *)(v11 + 16);
    HIDWORD(v22) = v10->InterruptCount - *(_DWORD *)(v11 + 24);
    v15 = *(_BYTE *)(v11 + 28);
    BYTE2(v23) = v15;
    if( NestingLevel == 1 )
    {
      if( (KeGetPcr()->Prcb._bf_0 & 0x10001) != 0 )
      {
        v16 = v15 | 0x40;
LABEL_18:
        BYTE2(v23) = v16;
        goto LABEL_19;
      }
    }
    else if( !NestingLevel )
    {
LABEL_19:
      v26 = 0;
      v24 = &v20;
      v25 = 56;
      EtwTraceKernelEvent((__int64)&v24, 1u, 0x20010000u, 0x529u, 0x602u);
      *(_BYTE *)(v7 + 257) = 0;
LABEL_20:
      v17 = v8 - 1;
      while( v9 < v17 )
      {
        v18 = 32 * ++v9;
        v19 = *(_OWORD *)(v18 + v7 + 16);
        *(_OWORD *)v11 = *(_OWORD *)(v18 + v7);
        *(_OWORD *)(v11 + 16) = v19;
        v11 += 32i64;
      }
      --*(_BYTE *)(v7 + 256);
      return;
    }
    v16 = v15 | 0x80;
    goto LABEL_18;
  }
}

Referenced by:

ExpReleaseSpinLockExclusiveFromDpcLevelInstrumented
ExpReleaseSpinLockSharedFromDpcLevelInstrumented
KiReleaseQueuedSpinLockInstrumented
KiReleaseSpinLockInstrumented