KiSendHeteroRescheduleIntRequestHelper
CHAR __fastcall KiSendHeteroRescheduleIntRequestHelper(UINT64 a1, _QWORD *a2, UINT64 *a3, INT64 a4){
unsigned int v4;
__int64 v5;
CHAR v6;
_QWORD *v7;
unsigned __int64 v8;
unsigned __int64 v9;
__int64 v10;
INT64 v11;
__int64 v13;
_KPRCB *v14;
int v15;
int v16;
int v18;
unsigned int v19;
UINT64 SpinCount;
_KPRCB *ControlPrcb;
_KSHARED_READY_QUEUE *ControlReadyQueue;
unsigned int Processor;
UINT64 *v25;
INT64 v26;
v26 = a4;
v25 = a3;
v4 = 0;
ControlReadyQueue = 0i64;
v5 = 0i64;
v18 = -1;
v6 = 0;
v19 = 0;
v7 = a2;
v8 = a1;
if( a1 )
{
while( 1 )
{
LODWORD(SpinCount) = 0;
_BitScanForward64(&v9, v8);
v8 ^= 1i64 << v9;
Processor = KiProcessorNumberToIndexMappingTable[64 * *(unsigned __int8 *)(a4 + 208) + (unsigned int)v9];
v10 = (__int64)*(&KiProcessorBlock + Processor);
ControlPrcb = (_KPRCB *)v10;
while( _interlockedbittestandset64((volatile signed __int32 *)(v10 + 48), 0i64) )
{
do
KeYieldProcessorEx(&SpinCount);
while( *(_QWORD *)(v10 + 48) );
}
v7 = a2;
v11 = *(_QWORD *)(v10 + 8);
if( (*(_BYTE *)(v10 + 35) & 1) != 0 && !*(_QWORD *)(v10 + 16) && !*(_BYTE *)(v10 + 12585) )
{
if( (unsigned int)KiCheckPreferredHeteroProcessor(*(_KTHREAD **)(v10 + 8), (_KPRCB *)v10) )
{
if( !a2 )
{
_InterlockedAdd16((volatile signed __int16 *)(v11 + 868), 1u);
_InterlockedAnd64((volatile signed __int64 *)(v10 + 48), 0i64);
HIDWORD(SpinCount) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)(v11 + 64), 0i64) )
{
do
KeYieldProcessorEx((UINT64 *)((char *)&SpinCount + 4));
while( *(_QWORD *)(v11 + 64) );
}
KiAcquireThreadStateLock((_ETHREAD *)v11, &ControlPrcb, &ControlReadyQueue);
_InterlockedAdd16((volatile signed __int16 *)(v11 + 868), 0xFFFFu);
if( *(_BYTE *)(v11 + 388) == 2 )
{
v14 = ControlPrcb;
if( !*((_BYTE *)ControlPrcb + 12585)
&& (unsigned int)KiCheckPreferredHeteroProcessor((_KTHREAD *)v11, ControlPrcb)
&& !_interlockedbittestandset((volatile signed __int32 *)(v11 + 120), 0xCu) )
{
*((_BYTE *)v14 + 12585) = 1;
KiSendSoftwareInterrupt(Processor, 2u);
v6 = 1;
}
}
KiReleaseThreadStateLock(v13, (__int64)ControlPrcb, (volatile signed __int64 *)ControlReadyQueue);
KiReleaseThreadLockSafe(v11);
goto LABEL_26;
}
if( (*(_DWORD *)(v11 + 120) & 0x1000) == 0 )
{
v5 |= 1i64 << Processor;
if( v18 == -1 || (v15 = *(char *)(v11 + 195), v15 > v18) )
{
v16 = *(char *)(v11 + 195);
v6 = 1;
v18 = v16;
v19 = Processor;
}
}
}
}
_InterlockedAnd64((volatile signed __int64 *)(v10 + 48), 0i64);
LABEL_26:
a4 = v26;
if( !v8 )
{
a3 = v25;
v4 = v19;
break;
}
}
}
if( v7 )
*v7 = v5;
if( a3 )
*(_DWORD *)a3 = v4;
return v6;
}Referenced by:
KiSendHeteroRescheduleIntRequest