PpmInstallFeedbackCounters

void __fastcall PpmInstallFeedbackCounters(__int64 a1, __int64 *a2){
  __int64 v2; 
  __int64 v4; 
  unsigned __int8 CurrentIrql; 
  __int64 v6; 
  __int64 v7; 
  LARGE_INTEGER PerformanceCounter; 
  bool v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  int v13; 
  struct _GROUP_AFFINITY v14; 
  struct _GROUP_AFFINITY PreviousAffinity; 
  int v16; 
  v13 = 0;
  v2 = a1;
  v4 = *(unsigned int *)(a1 + 36);
  v14 = 0i64;
  *(_DWORD *)v14.Reserved = 0;
  LODWORD(v4) = KiProcessorIndexToNumberMappingTable[v4];
  *(_DWORD *)&v14.Group = (unsigned __int16)((unsigned int)v4 >> 6);
  v14.Reserved[2] = 0;
  v14.Mask = 1i64 << (v4 & 0x3F);
  PreviousAffinity = 0i64;
  KeSetSystemGroupAffinityThread(&v14, &PreviousAffinity);
  CurrentIrql = KeGetCurrentIrql();
  v6 = 2i64;
  __writecr8(2ui64);
  v7 = v2 + 32840;
  PerformanceCounter = KeQueryPerformanceCounter(0i64);
  PpmContinueActiveTimeAccumulation(v2, PerformanceCounter.QuadPart);
  LOWORD(v2) = v16;
  _disable();
  v9 = (v2 & 0x200) != 0;
  KxAcquireSpinLock((UINT64 *)v7);
  v11 = v7 - (_QWORD)a2;
  do
  {
    v12 = *a2;
    if( *a2 )
    {
      if( *(_BYTE *)(v12 + 34) )
      {
        *(_BYTE *)(v7 + 137) = 1;
        v12 = *a2;
      }
      *(__int64 *)((char *)a2 + v11 + 24) = v12;
      LOBYTE(v10) = 1;
      *(__int64 *)((char *)a2 + v11 + 64) = 100i64 * *(_QWORD *)(v7 + 48);
      PpmPerfFeedbackCounterRead(*a2, v10, &v13);
    }
    ++a2;
    --v6;
  }
  while( v6 );
  if( *(_QWORD *)(v7 + 32) )
  {
    *(_BYTE *)(v7 + 136) = 1;
  }
  else if( *(_QWORD *)(v7 + 24) )
  {
    *(_BYTE *)(v7 + 136) = 0;
  }
  KxReleaseSpinLock((UINT64 *)v7);
  if( v9 )
    _enable();
  __writecr8(CurrentIrql);
  KeRevertToUserGroupAffinityThread(&PreviousAffinity);
}

Referenced by:

PpmRegisterPerfStates