Amd64SetInterval

INT64 __fastcall Amd64SetInterval(INT64 a1, INT64 *a2){
  unsigned int v2; 
  unsigned __int64 v4; 
  int ProfileDescriptor; 
  __int64 v7; 
  unsigned int v8; 
  __int64 v9; 
  unsigned int v10; 
  unsigned int v11; 
  __int64 v12; 
  _DWORD *v13; 
  __int64 a3; 
  a3 = 0i64;
  v2 = a1;
  v4 = (unsigned __int8)HalpAcquireHighLevelLock(&Amd64ProfileSourceDescriptorListLock);
  ProfileDescriptor = HalpGetProfileDescriptor(v2, &Amd64ProfileSourceDescriptorListHead, &a3);
  if( ProfileDescriptor >= 0 )
  {
    v7 = a3;
    v8 = *(_DWORD *)a2;
    v9 = *(unsigned __int8 *)(a3 + 28);
    v10 = HIDWORD(Amd64ProfileIntervalLimits[v9]);
    if( *(_DWORD *)a2 < v10 )
    {
      *(_DWORD *)a2 = v10;
      v8 = v10;
    }
    v11 = Amd64ProfileIntervalLimits[v9];
    if( v8 > v11 )
    {
      *(_DWORD *)a2 = v11;
      v8 = v11;
    }
    *(_DWORD *)(v7 + 24) = v8;
    KxReleaseSpinLock(&Amd64ProfileSourceDescriptorListLock);
    __writecr8(v4);
    if( !v2 )
      HalpTimerSetProfilingTarget(
        *(unsigned int *)a2,
        *(unsigned int *)a2 * (unsigned __int64)*((unsigned int *)KeGetCurrentPrcb() + 17) / 0xA);
    v12 = 4i64;
    v13 = (_DWORD *)(Amd64CounterStatus + ((unsigned __int64)*((unsigned int *)KeGetPcr() + 105) << 6) + 8);
    do
    {
      if( *(v13 - 1) == v2 && !*(v13 - 2) )
        *v13 = *(_DWORD *)a2;
      v13 += 4;
      --v12;
    }
    while( v12 );
    return 0i64;
  }
  else
  {
    KxReleaseSpinLock(&Amd64ProfileSourceDescriptorListLock);
    __writecr8(v4);
    return(unsigned int)ProfileDescriptor;
  }
}

Referenced by:

No references.