HalpTimerReadTimerPairWithLatencyLimit

UINT64 __fastcall HalpTimerReadTimerPairWithLatencyLimit(
        unsigned int a1,
        __int64 a2,
        __int64 a3,
        UINT64 *a4,
        UINT64 *a5){
  unsigned __int64 v7; 
  unsigned __int64 v9; 
  void *v10; 
  void *v11; 
  void *v12; 
  __int64 v13; 
  __int64 PerformanceCounter; 
  void *v15; 
  void *v16; 
  void *v17; 
  __int64 v18; 
  __int64 v19; 
  unsigned __int64 v20; 
  UINT64 result; 

  v7 = a1;
  do
  {
    HalpProcessorFence();
    v9 = __rdtsc();
    HalpProcessorFence();
    if( a2 == HalpPerformanceCounter && HalpTimerFrequenciesMeasured )
    {
      PerformanceCounter = KeQueryPerformanceCounter(0i64);
    }
    else
    {
      HalpTimerGetInternalData((_KDPC *)a2, v10, v11, v12);
      PerformanceCounter = (*(__int64(__fastcall **)(__int64))(a2 + 112))(v13);
    }
    *a4 = PerformanceCounter;
    HalpProcessorFence();
    if( a3 == HalpPerformanceCounter && HalpTimerFrequenciesMeasured )
    {
      v19 = KeQueryPerformanceCounter(0i64);
    }
    else
    {
      HalpTimerGetInternalData((_KDPC *)a3, v15, v16, v17);
      v19 = (*(__int64(__fastcall **)(__int64))(a3 + 112))(v18);
    }
    *a5 = v19;
    HalpProcessorFence();
    v20 = __rdtsc();
    result = HalpProcessorFence();
  }
  while( v20 - v9 > v7 );
  return result;
}

Referenced by:

HalpTimerMeasureFrequencies
HalpTimerMeasureProcessorsWorker