PpmIdleCheckCoordinatedDependency
UINT64 __fastcall PpmIdleCheckCoordinatedDependency(
_KPRCB *Prcb,
UINT64 PreselectState,
UINT64 RemainingLatency,
UINT64 ExpectedIdle,
UINT64 EntryPriority,
_PPM_SELECTION_MENU *Menu,
UINT *ProcessorState,
_PPM_COORDINATED_SELECTION *CoordinatedSelection,
_KAFFINITY_EX *SecondaryMask){
_KPRCB *v9;
unsigned int v10;
UINT64 *p_Count;
INT64 v12;
__int64 v13;
unsigned int v14;
_RTL_PROCESS_MODULES *v15;
UINT64 v16;
char v17;
__int64 v18;
UINT64 v19;
__int64 v20;
UINT64 v21;
__int64 v22;
__int64 v23;
unsigned int v24;
unsigned int v25;
INT64 v26;
_KPRCB *v27;
int v28;
UINT64 StateIndex;
UINT64 Dependencies;
UINT64 v32;
UINT64 ProcessorNumber;
__int128 v34;
__int64 v35;
_LIST_ENTRY LoadOrderListHead;
__int64 v37;
__int64 v38;
unsigned int PreselectStatea;
unsigned int v41;
v41 = RemainingLatency;
PreselectStatea = PreselectState;
ProcessorNumber = 0i64;
v9 = Prcb;
v32 = 0xFFFFFFFF00000000ui64;
v10 = RemainingLatency;
p_Count = (UINT64 *)&Menu->Count;
v35 = 0i64;
v12 = 2147483649i64;
v13 = *((unsigned int *)Prcb + 9);
v34 = 0i64;
v14 = KiProcessorIndexToNumberMappingTable[v13];
v15 = 0i64;
v16 = 48i64 * Menu->Entries->StateIndex + ((unsigned __int64)v14 >> 6);
v17 = (*(_QWORD *)(PpmPlatformStates + 8 * v16 + 136) >> (v14 & 0x3F)) & 1;
v18 = 0i64;
if( !Menu->Count )
return v12;
while( 1 )
{
v19 = p_Count[1];
v20 = 3 * v18;
v21 = PpmPlatformStates;
v22 = *(unsigned int *)(v19 + 24 * v18 + 4);
v23 = 384 * v22;
if( v17 )
{
LODWORD(v32) = CoordinatedSelection->SelectedStates;
if( !*(_BYTE *)(v19 + 24 * v18 + 1) )
goto LABEL_25;
HIDWORD(v32) = -1;
LODWORD(Dependencies) = EntryPriority;
LODWORD(StateIndex) = v22;
v12 = PpmIdleCheckCoordinatedStateEligibility(
v9,
PreselectStatea,
v10,
ExpectedIdle,
StateIndex,
Dependencies,
(UINT *)&v32 + 1,
CoordinatedSelection);
if( !v12 )
goto LABEL_17;
LABEL_23:
PpmIdleRollbackCoordinatedSelection((INT64)CoordinatedSelection, (unsigned int)v32);
v15 = 0i64;
goto LABEL_24;
}
if( !*(_BYTE *)(v19 + 24 * v18 + 2) )
goto LABEL_25;
v24 = *(_DWORD *)(v23 + PpmPlatformStates + 320);
if( (v24 & 0x4000000) == 0 )
{
v38 = 0x100000000i64;
LoadOrderListHead.Flink = 0i64;
LoadOrderListHead.Blink = (_LIST_ENTRY *)PopIdleTransitionTimeout;
v37 = 0i64;
if( (v24 & 0x3000000) == 0x1000000 )
{
do
{
if( v24 >> 27 > (unsigned int)EntryPriority )
break;
PpmIdleTransitionStall(&LoadOrderListHead, v15, v16, p_Count);
v24 = *(_DWORD *)(v23 + v21 + 320);
}
while( (v24 & 0x3000000) == 0x1000000 );
v9 = Prcb;
v15 = 0i64;
v10 = v41;
p_Count = (UINT64 *)&Menu->Count;
}
if( (v24 & 0x4000000) == 0 )
{
v12 = 2147483659i64;
goto LABEL_25;
}
}
v25 = *(_DWORD *)(v23 + v21 + 72);
if( v25 <= v10 )
break;
v12 = 2147483650i64;
LABEL_24:
p_Count = (UINT64 *)&Menu->Count;
LABEL_25:
v18 = (unsigned int)(HIDWORD(ProcessorNumber) + 1);
HIDWORD(ProcessorNumber) = v18;
if( (unsigned int)v18 >= *(_DWORD *)p_Count )
return v12;
v9 = Prcb;
v10 = v41;
}
LODWORD(Dependencies) = *(_DWORD *)(v19 + 8 * v20 + 8);
v26 = PpmIdleCheckCoordinatedDependencies(
v9,
PreselectStatea,
(unsigned int)EntryPriority,
v25 - v10,
ExpectedIdle,
Dependencies,
*(_PPM_SELECTION_DEPENDENCY **)(v19 + 8 * v20 + 16),
0i64,
0i64,
SecondaryMask);
v15 = 0i64;
v12 = v26;
if( v26 )
goto LABEL_24;
LABEL_17:
if( *(_BYTE *)(v19 + 8 * v20) )
{
LOWORD(v35) = 0;
v12 = 0i64;
*((_QWORD *)&v34 + 1) = *(_QWORD *)(v23 + v21 + 128 + 8);
*(_QWORD *)&v34 = v23 + v21 + 128;
while( !(unsigned int)KeEnumerateNextProcessor(&ProcessorNumber, (unsigned __int16 **)&v34) )
{
KeGetPrcb((unsigned int)ProcessorNumber);
if( Prcb != v27 )
{
v28 = PpmTestAndLockProcessor((INT64)v27, SecondaryMask, 0i64);
v15 = 0i64;
if( v28 < 0 )
{
v12 = 2147483653i64;
if( !v17 )
goto LABEL_24;
goto LABEL_23;
}
}
}
}
if( v17 )
*ProcessorState = HIDWORD(v32);
return v12;
}Referenced by:
PpmIdleCheckCoordinatedDependencies