PpmIdleCheckCoordinatedDependency
UINT64 __stdcall PpmIdleCheckCoordinatedDependency(
_KPRCB *Prcb,
UINT64 PreselectState,
UINT64 RemainingLatency,
UINT64 ExpectedIdle,
UINT64 EntryPriority,
_PPM_SELECTION_MENU *Menu,
UINT64 *ProcessorState,
_PPM_COORDINATED_SELECTION *CoordinatedSelection,
_KAFFINITY_EX *SecondaryMask){
_KPRCB *v9;
unsigned int v10;
_PPM_SELECTION_MENU *v11;
UINT64 v12;
__int64 Number;
char v14;
__int64 v15;
_PPM_SELECTION_MENU_ENTRY *Entries;
__int64 v17;
__int64 v18;
__int64 v19;
__int64 v20;
unsigned int v21;
unsigned int v22;
int v23;
_KPRCB *v24;
UINT64 StateIndex;
UINT64 Dependencies;
UINT64 PreviouslySelectedStates;
UINT64 ProcIndex;
_KAFFINITY_ENUMERATION_CONTEXT Context;
_QWORD v31[13];
unsigned int PreselectStatea;
unsigned int v34;
v34 = RemainingLatency;
PreselectStatea = PreselectState;
ProcIndex = 0i64;
v9 = Prcb;
PreviouslySelectedStates = 0xFFFFFFFF00000000ui64;
v10 = RemainingLatency;
v11 = Menu;
v12 = 2147483649i64;
Number = Prcb->Number;
memset(&Context, 0, sizeof(Context));
v14 = (*(_QWORD *)(PpmPlatformStates
+ 8
* (48i64 * Menu->Entries->StateIndex
+ ((unsigned __int64)(unsigned int)KiProcessorIndexToNumberMappingTable[Number] >> 6))
+ 136) >> (KiProcessorIndexToNumberMappingTable[Number] & 0x3F)) & 1;
v15 = 0i64;
if( !Menu->Count )
return v12;
while( 1 )
{
Entries = v11->Entries;
v17 = v15;
v18 = PpmPlatformStates;
v19 = Entries[v15].StateIndex;
v20 = 384 * v19;
if( v14 )
{
LODWORD(PreviouslySelectedStates) = CoordinatedSelection->SelectedStates;
if( !Entries[v15].InitiatingState )
goto LABEL_25;
HIDWORD(PreviouslySelectedStates) = -1;
LODWORD(Dependencies) = EntryPriority;
LODWORD(StateIndex) = v19;
v12 = PpmIdleCheckCoordinatedStateEligibility(
v9,
PreselectStatea,
v10,
ExpectedIdle,
StateIndex,
Dependencies,
(UINT64 *)((char *)&PreviouslySelectedStates + 4),
CoordinatedSelection);
if( !v12 )
goto LABEL_17;
LABEL_23:
PpmIdleRollbackCoordinatedSelection(CoordinatedSelection, (unsigned int)PreviouslySelectedStates);
goto LABEL_24;
}
if( !Entries[v15].DependentState )
goto LABEL_25;
v21 = *(_DWORD *)(v20 + PpmPlatformStates + 320);
if( (v21 & 0x4000000) == 0 )
{
v31[3] = 0x100000000i64;
v31[0] = 0i64;
v31[1] = PopIdleTransitionTimeout;
v31[2] = 0i64;
if( (v21 & 0x3000000) == 0x1000000 )
{
do
{
if( v21 >> 27 > (unsigned int)EntryPriority )
break;
PpmIdleTransitionStall((__int64)v31);
v21 = *(_DWORD *)(v20 + v18 + 320);
}
while( (v21 & 0x3000000) == 0x1000000 );
v9 = Prcb;
v10 = v34;
v11 = Menu;
}
if( (v21 & 0x4000000) == 0 )
{
v12 = 2147483659i64;
goto LABEL_25;
}
}
v22 = *(_DWORD *)(v20 + v18 + 72);
if( v22 <= v10 )
break;
v12 = 2147483650i64;
LABEL_24:
v11 = Menu;
LABEL_25:
v15 = (unsigned int)(HIDWORD(ProcIndex) + 1);
HIDWORD(ProcIndex) = v15;
if( (unsigned int)v15 >= v11->Count )
return v12;
v9 = Prcb;
v10 = v34;
}
LODWORD(Dependencies) = Entries[v17].Dependencies;
v12 = PpmIdleCheckCoordinatedDependencies(
v9,
PreselectStatea,
(unsigned int)EntryPriority,
v22 - v10,
ExpectedIdle,
Dependencies,
Entries[v17].DependencyList,
0i64,
0i64,
SecondaryMask);
if( v12 )
goto LABEL_24;
LABEL_17:
if( Entries[v17].StrictDependency )
{
Context.CurrentIndex = 0;
v12 = 0i64;
Context.CurrentMask = *(_QWORD *)(v20 + v18 + 128 + 8);
Context.Affinity = (_KAFFINITY_EX *)(v20 + v18 + 128);
while( 1 )
{
KeEnumerateNextProcessor(&ProcIndex, &Context);
if( v23 )
break;
v24 = KeGetPrcb((unsigned int)ProcIndex);
if( Prcb != v24 && PpmTestAndLockProcessor(v24, SecondaryMask, 0i64) < 0 )
{
v12 = 2147483653i64;
if( !v14 )
goto LABEL_24;
goto LABEL_23;
}
}
}
if( v14 )
*(_DWORD *)ProcessorState = HIDWORD(PreviouslySelectedStates);
return v12;
}Referenced by:
PpmIdleCheckCoordinatedDependencies