KiSetClockInterval

VOID __fastcall KiSetClockInterval(
        UINT64 DesiredInterval,
        UINT8 IsExClockIntervalRequest,
        _CLOCK_INTERVAL_REQUEST *Request){
  unsigned int v5; 
  UINT64 Root; 
  BOOL v7; 
  UINT64 v8; 
  UINT64 v9; 

  v5 = DesiredInterval;
  if( Request[1].RbNode[4] )
    RtlRbRemoveNode((UINT64 *)&qword_140CEBF00, (UINT64)Request);
  *(_DWORD *)&Request[1].RbNode[8] = v5;
  Root = (UINT64)qword_140CEBF00.Root;
  if( (qword_140CEBF08 & 1) != 0 && qword_140CEBF00.Root )
    Root = (unsigned __int64)&qword_140CEBF00 ^ (unsigned __int64)qword_140CEBF00.Root;
  v7 = 0;
  if( Root )
  {
    while( 1 )
    {
      if( v5 < *(_DWORD *)(Root + 28) )
      {
        v8 = *(_QWORD *)Root;
        if( (qword_140CEBF08 & 1) != 0 )
        {
          if( !v8 )
            break;
          v8 ^= Root;
        }
        if( !v8 )
          break;
      }
      else
      {
        v8 = *(_QWORD *)(Root + 8);
        if( (qword_140CEBF08 & 1) != 0 )
        {
          if( !v8 )
            goto LABEL_18;
          v8 ^= Root;
        }
        if( !v8 )
        {
LABEL_18:
          v7 = 1;
          break;
        }
      }
      Root = v8;
    }
  }
  RtlRbInsertNodeEx((UINT64 *)&qword_140CEBF00, Root, v7, (UINT64)Request);
  Request[1].RbNode[4] = 1;
  KiSetClockIntervalToMinimumRequested();
  if( IsExClockIntervalRequest )
    KePseudoHrTimeIncrement = v5;
  v9 = *(unsigned int *)&Request[1].Inserted;
  if( (_DWORD)v9 )
    PoTraceSystemTimerResolutionKernel(v5, v9);
}

Referenced by:

ExpUpdateTimerConfigurationWorker
KiSetVirtualHeteroClockIntervalRequest