PopCheckForIdleness
VOID __stdcall PopCheckForIdleness(_KDPC *Dpc, VOID *DeferredContext, VOID *SystemArgument1, VOID *SystemArgument2){
int ActiveProcessorCount;
unsigned __int8 CurrentIrql;
int v6;
volatile unsigned __int64 TickCountQuad;
unsigned int v8;
unsigned int v9;
int v10;
signed int v11;
UINT64 v12;
UINT8 v13;
int v14;
signed int v15;
int v16;
int v17;
UINT64 ProcIndex;
volatile unsigned __int64 v19;
_KAFFINITY_ENUMERATION_CONTEXT Context;
*(_DWORD *)(&Context.CurrentIndex + 1) = 0;
*(&Context.CurrentIndex + 3) = 0;
LODWORD(ProcIndex) = 0;
ActiveProcessorCount = KeQueryActiveProcessorCountEx(0xFFFFu);
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
v6 = qword_140C231D8;
TickCountQuad = KUSER_SHARED_DATA.TickCountQuad;
v19 = KUSER_SHARED_DATA.TickCountQuad;
__writecr8(CurrentIrql);
if( byte_140C231D5 )
{
v8 = TickCountQuad - v6;
if( (int)TickCountQuad - v6 <= 0 )
{
byte_140C231D5 = 0;
goto LABEL_25;
}
Context.CurrentMask = KeActiveProcessors.Bitmap[0];
Context.CurrentIndex = 0;
v9 = 100;
Context.Affinity = &KeActiveProcessors;
v10 = 0;
v11 = 100;
KeEnumerateNextProcessor(&ProcIndex, &Context);
if( !v14 )
{
do
{
v15 = 100
* ((*(&KiProcessorBlock + (unsigned int)ProcIndex))->IdleThread->Tcb.SchedulerApc.SpareLong0
- (*(&KiProcessorBlock + (unsigned int)ProcIndex))->PowerState.LastSysTime)
/ v8;
if( v15 < v11 )
v11 = 100
* ((*(&KiProcessorBlock + (unsigned int)ProcIndex))->IdleThread->Tcb.SchedulerApc.SpareLong0
- (*(&KiProcessorBlock + (unsigned int)ProcIndex))->PowerState.LastSysTime)
/ v8;
v10 += v15;
KeEnumerateNextProcessor(&ProcIndex, &Context);
}
while( !v16 );
TickCountQuad = v19;
if( v11 <= 100 )
{
if( v11 < 0 )
v11 = 0;
}
else
{
v11 = 100;
}
}
if( v10 / ActiveProcessorCount <= 100 )
{
v9 = v10 / ActiveProcessorCount;
if( v10 / ActiveProcessorCount < 0 )
v9 = 0;
}
dword_140C231A4 = v11;
PopSIdle = v9;
if( !PopPlatformAoAc )
{
if( (_DWORD)Timeout )
{
LODWORD(AccumulatedIdleTime) = PopIdleScanInterval + AccumulatedIdleTime;
PopDiagTraceIdleCheck(v12, (unsigned int)v11, v9, v13);
if( !PopPlatformAoAc
&& PopPreSleepNotificationSeconds + 120 <= (unsigned int)Timeout
&& (int)AccumulatedIdleTime + PopPreSleepNotificationSeconds >= (unsigned int)Timeout
&& !PopIsAboutToSleep )
{
PopIsAboutToSleep = 1;
PopQueueWorkItem(&PopPreSleepNotifyWorkItem);
}
}
}
}
Context.CurrentMask = KeActiveProcessors.Bitmap[0];
Context.Affinity = &KeActiveProcessors;
qword_140C231D8 = TickCountQuad;
byte_140C231D5 = 1;
Context.CurrentIndex = 0;
while( 1 )
{
KeEnumerateNextProcessor(&ProcIndex, &Context);
if( v17 )
break;
(*(&KiProcessorBlock + (unsigned int)ProcIndex))->PowerState.LastSysTime = (*(&KiProcessorBlock
+ (unsigned int)ProcIndex))->IdleThread->Tcb.SchedulerApc.SpareLong0;
}
LABEL_25:
PopGetPolicyWorker(PopPlatformAoAc != 0 ? 128 : 8);
PopCheckForWork();
}Referenced by:
No references.