PpmPerfApplyProcessorStates

UINT8 __stdcall PpmPerfApplyProcessorStates(){
  UINT8 v0; 
  INT64 i; 
  int v2; 
  _KPRCB *Prcb; 
  _PROC_PERF_CONSTRAINT *Constraint; 
  int v5; 
  _KPRCB *v6; 
  INT64 v7; 
  INT64 v8; 
  unsigned int v9; 
  INT64 v10; 
  UINT64 ProcIndex; 
  _KAFFINITY_ENUMERATION_CONTEXT Context; 
  _KAFFINITY_EX Affinity; 

  v0 = 0;
  *(_QWORD *)&Affinity.Count = 1310721i64;
  *(_DWORD *)(&Context.CurrentIndex + 1) = 0;
  *(&Context.CurrentIndex + 3) = 0;
  LODWORD(ProcIndex) = 0;
  memset(Affinity.Bitmap, 0, sizeof(Affinity.Bitmap));
  for( i = PpmPerfDomainHead; (INT64 *)i != &PpmPerfDomainHead; i = *(_QWORD *)i )
  {
    if( *(_BYTE *)(i + 766) )
    {
      KeOrAffinityEx((INT8 *)(i + 24), &Affinity.Count, (INT8 *)&Affinity);
      LODWORD(ProcIndex) = 0;
      if( *(_DWORD *)(i + 200) )
      {
        v9 = 0;
        do
        {
          v10 = *(_QWORD *)(i + 216) + 136i64 * v9;
          if( *(_DWORD *)(v10 + 16) )
          {
            if( *(_BYTE *)(v10 + 124) )
            {
              LOBYTE(v7) = 1;
              PpmPerfApplyHiddenProcessorState(i, *(_QWORD *)(i + 216) + 136i64 * v9, v7, v8);
              *(_BYTE *)(v10 + 124) = 0;
            }
            PpmPerfApplyHiddenProcessorState(i, v10, 0i64, v8);
          }
          ++v9;
        }
        while( v9 < *(_DWORD *)(i + 200) );
        LODWORD(ProcIndex) = v9;
      }
      *(_BYTE *)(i + 766) = 0;
    }
  }
  Context.CurrentMask = Affinity.Bitmap[0];
  Context.Affinity = &Affinity;
  Context.CurrentIndex = 0;
  while( 1 )
  {
    KeEnumerateNextProcessor(&ProcIndex, &Context);
    if( v2 )
      break;
    Prcb = KeGetPrcb((unsigned int)ProcIndex);
    Constraint = Prcb->PowerState.CheckContext.Constraint;
    if( Constraint->Force )
    {
      if( PpmPerfApplyProcessorState(Prcb, 1u) )
      {
        Constraint->Force = 0;
        goto LABEL_8;
      }
    }
    else
    {
LABEL_8:
      if( PpmPerfApplyProcessorState(Prcb, 0) )
        KeRemoveProcessorAffinityEx(&Affinity.Count, (unsigned int)ProcIndex);
    }
  }
  *(&PopIrpWorkerControlEvent + 316) = KeCountSetBitsAffinityEx(&Affinity.Count);
  if( !*(&PopIrpWorkerControlEvent + 316) )
    return 1;
  Context.CurrentMask = Affinity.Bitmap[0];
  Context.Affinity = &Affinity;
  Context.CurrentIndex = 0;
  while( 1 )
  {
    KeEnumerateNextProcessor(&ProcIndex, &Context);
    if( v5 )
      break;
    v6 = KeGetPrcb((unsigned int)ProcIndex);
    PpmPerfQueueAction(v6, PpmPerfActionApplyProcessorState);
  }
  return v0;
}

Referenced by:

No references.