PopInitializeHeteroProcessors
VOID __stdcall PopInitializeHeteroProcessors(){
char v0;
char v1;
char v2;
char v3;
char v4;
unsigned __int8 v5;
char *v6;
unsigned int v7;
__int64 v8;
UINT8 v9;
__int64 v10;
unsigned __int8 v11;
int v12;
int v13;
__int64 v14;
_PROC_PERF_DOMAIN *Domain;
unsigned __int8 HighestPerformanceClass;
int v17;
unsigned int ActiveProcessorCount;
_BYTE *v19;
signed __int64 v20;
__int64 v21;
char v22;
UINT64 *v23;
_EPROCESS *v24;
VOID *v25;
_WORD *v26;
unsigned int v27;
__int64 v28;
_KPRCB *Prcb;
__int16 Group;
int v31;
PEVENT_DATA_DESCRIPTOR UserData;
UINT8 MostFavoredClass[4];
__int16 v34;
UINT64 ProcIndex;
_KAFFINITY_ENUMERATION_CONTEXT Context;
_KAFFINITY_ENUMERATION_CONTEXT v37;
_EVENT_DATA_DESCRIPTOR v38;
unsigned __int8 *p_GroupIndex;
__int64 v40;
unsigned __int8 *p_ArchitecturalEfficiencyClass;
__int64 v42;
unsigned __int8 *p_PerformanceSchedulingClass;
__int64 v44;
unsigned __int8 *p_EfficiencySchedulingClass;
__int64 v46;
v1 = v0;
v2 = 0;
v3 = 1;
if( (PpmBackgroundProfile || PpmEntryLevelPerfProfile || PpmMultimediaQosProfile)
&& PpmPerfSchedulerDirectedPerfStatesSupported
&& (unsigned int)KeQueryActiveProcessorCountEx(0) >= 2 )
{
v2 = 1;
}
v4 = v2;
if( PpmPerfVmQosSupported )
v4 = 1;
if( !v4 || (v5 = 1, PpmPerfQosGroupPolicyDisable) )
v5 = 0;
if( v1 )
{
v6 = (char *)PpmHeteroCapabilityTest;
v7 = 0;
if( *(_DWORD *)PpmHeteroCapabilityTest )
{
do
{
v8 = v7++;
*(_WORD *)&v6[2 * v8 + 7 + v8] = 0;
}
while( v7 < *(_DWORD *)v6 );
}
PpmHeteroComputeRelativePerformance();
PpmHeteroUpdateHgsConfiguration();
v9 = PopDetectSimulatedHeteroProcessors((_KAFFINITY_EX *)v6);
*(_DWORD *)MostFavoredClass = v9;
v10 = v9 != 0;
if( !v9 )
{
v11 = PpmHeteroDetectHgsCores((INT64)v6);
*(_DWORD *)MostFavoredClass = v11;
if( v11 )
{
LODWORD(v10) = 5;
}
else
{
*(_DWORD *)(&Context.CurrentIndex + 1) = 0;
*(&Context.CurrentIndex + 3) = 0;
LODWORD(ProcIndex) = 0;
if( (unsigned __int8)PpmHeteroNominalPerformanceClasses > 1u
|| (unsigned __int8)PpmHeteroHighestPerformanceClasses > 1u )
{
Context.CurrentMask = PpmPerfStatesRegistered.Bitmap[0];
Context.CurrentIndex = 0;
Context.Affinity = &PpmPerfStatesRegistered;
KeEnumerateNextProcessor(&ProcIndex, &Context);
if( !v13 )
{
do
{
v14 = (unsigned int)ProcIndex;
Domain = KeGetPrcb((unsigned int)ProcIndex)->PowerState.CheckContext.Domain;
if( (unsigned __int8)PpmHeteroNominalPerformanceClasses <= 1u )
HighestPerformanceClass = Domain->HighestPerformanceClass;
else
HighestPerformanceClass = Domain->NominalPerformanceClass;
v6[2 * v14 + 8 + v14] = HighestPerformanceClass;
KeEnumerateNextProcessor(&ProcIndex, &Context);
}
while( !v17 );
v3 = 1;
}
v6[5] = 1;
v12 = 1;
}
else
{
v12 = 0;
}
*(_DWORD *)MostFavoredClass = v12;
if( v12 )
{
LODWORD(v10) = 3;
}
else if( v5 )
{
*(_DWORD *)MostFavoredClass = 1;
LODWORD(v10) = 4;
}
}
}
if( (_DWORD)v10 == PopHeteroSystem )
{
v3 = 0;
ActiveProcessorCount = KeQueryActiveProcessorCountEx(0xFFFFu);
if( ActiveProcessorCount )
{
v19 = v6 + 7;
v20 = (_BYTE *)PpmHeteroCapability - v6;
v21 = ActiveProcessorCount;
do
{
if( v19[v20] != *v19 || v19[v20 + 1] != v19[1] )
v3 = 1;
v19 += 3;
--v21;
}
while( v21 );
}
}
}
else
{
LODWORD(v10) = PopHeteroSystem;
v6 = (char *)PpmHeteroCapability;
v3 = 0;
*(_DWORD *)MostFavoredClass = PopHeteroSystem != 0;
}
PopConfigureHeteroPolicies((PPM_HETERO_SYSTEM)v10);
if( (v3 || (_DWORD)v10 && v22 || PpmPerfQosSupportedAndAllowed != v5)
&& (unsigned int)KeConfigureHeteroProcessors((_KAFFINITY_EX *)v6, v5, (UINT8)MostFavoredClass, v23) )
{
PsEnumProcesses((INT64)PopUpdateSingleProcessHeteroPolicies, 0i64, v24, v25, UserData);
}
if( *(_DWORD *)MostFavoredClass )
{
PopHeteroSystem = v10;
if( v6 != PpmHeteroCapability )
memmove(PpmHeteroCapability, v6, 3 * (*(_DWORD *)v6 + 2));
if( v5 )
PpmIdleEnableIdleDurationExpirationTimeout();
goto LABEL_56;
}
v26 = PpmHeteroCapability;
v27 = 0;
PopHeteroSystem = 0;
if( *(_DWORD *)PpmHeteroCapability )
{
do
{
v28 = v27++;
*(_WORD *)((char *)&v26[v28 + 3] + v28 + 1) = 0;
*((_BYTE *)&v26[v28 + 3] + v28) = 0;
v26[2] = 0;
}
while( v27 < *(_DWORD *)v26 );
}
if( v4 )
LABEL_56:
PpmPerfQosSupportedAndConfigured = 1;
if( ((PopHeteroSystem - 1) & 0xFFFFFFFA) != 0 || PopHeteroSystem == 6 )
PpmHeteroPolicy = 0;
else
PpmHeteroPolicy = PpmHeteroDesiredPolicy;
if( PpmPerfArtificialDomainSetting == -1 )
PpmPerfArtificialDomainEnabled = PopHeteroSystem != 0;
*(_DWORD *)(&v37.CurrentIndex + 1) = 0;
*(&v37.CurrentIndex + 3) = 0;
HIDWORD(ProcIndex) = 0;
if( PpmEtwRegistered && EtwEventEnabled(PpmEtwHandle, &PPM_ETW_PROCESSOR_CLASS_UPDATE) )
{
v37.CurrentMask = PpmCheckRegistered.Bitmap[0];
v37.Affinity = &PpmCheckRegistered;
v37.CurrentIndex = 0;
while( 1 )
{
KeEnumerateNextProcessor((UINT64 *)((char *)&ProcIndex + 4), &v37);
if( v31 )
break;
Prcb = KeGetPrcb(HIDWORD(ProcIndex));
Group = Prcb->Group;
v38.Ptr = (unsigned __int64)&v34;
v34 = Group;
p_PerformanceSchedulingClass = &Prcb->PowerState.PerformanceSchedulingClass;
p_GroupIndex = &Prcb->GroupIndex;
p_EfficiencySchedulingClass = &Prcb->PowerState.EfficiencySchedulingClass;
p_ArchitecturalEfficiencyClass = &Prcb->PowerState.ArchitecturalEfficiencyClass;
*(_QWORD *)&v38.Size = 2i64;
v40 = 1i64;
v42 = 1i64;
v44 = 1i64;
v46 = 1i64;
EtwWrite(PpmEtwHandle, &PPM_ETW_PROCESSOR_CLASS_UPDATE, 0, 5u, &v38);
}
}
PpmEventHeteroPolicy(0);
PpmPerfQosSupportedAndAllowed = v5;
}Referenced by:
PoInitSystem
PpmReapplyPerfPolicy