HalRequestSoftwareInterrupt
NTSTATUS __fastcall HalRequestSoftwareInterrupt(
VOID *a1,
INT64 a2,
INT64 *a3,
INT64 a4,
INT64 a5,
INT64 a6,
INT64 a7,
INT64 a8,
INT64 a9,
INT64 a10,
INT64 a11){
unsigned int v11;
__int64(__fastcall *v12)(_QWORD, int *, __int128 *, _QWORD, int *);
unsigned __int64 v13;
unsigned __int16 i;
__int64 v15;
__int64 v16;
__int16 v17;
unsigned int *v18;
unsigned __int64 Mask;
int v20;
unsigned __int8 v21;
__int64(__fastcall *v22)(_QWORD, int *, __int128 *, _QWORD, int *);
unsigned __int64 v23;
__int64 v24;
unsigned __int64 v25;
__int64 v26;
__int64(__fastcall *v27)(_QWORD, int *, __int128 *, _QWORD, int *);
unsigned __int64 v28;
__int64 v29;
unsigned __int64 v30;
__int64(__fastcall *v31)(_QWORD, int *, __int128 *, _QWORD, int *);
struct _PROCESSOR_NUMBER ProcNumber;
__int128 v34;
__int64 v35;
int v36[2];
int v37[2];
int v38[2];
int v39[2];
int v40[2];
int v41[2];
int v42[2];
int v43[4];
__int128 v44;
__int64 v45;
_GROUP_AFFINITY Result;
_KAFFINITY_EX Affinity;
unsigned __int16 v48;
unsigned __int16 v49;
int j;
_QWORD v51[21];
int v52;
v11 = 31;
if( (_BYTE)a1 != 1 )
v11 = 47;
memset((INT64)Affinity.Bitmap, 0i64);
v45 = 0i64;
v44 = 0i64;
if( (*(_DWORD *)(HalpInterruptController + 220) & 0x40) != 0 && !HalpInterruptNoShorthand )
{
LODWORD(v44) = 3;
v36[0] = -1;
v36[1] = 1;
v37[1] = *(_DWORD *)(HalpInterruptIpiLines + 20);
v37[0] = *(_DWORD *)(HalpInterruptIpiLines + 16);
v12 = *(__int64(__fastcall **)(_QWORD, int *, __int128 *, _QWORD, int *))(HalpInterruptController + 120);
_disable();
LODWORD(v13) = v12(*(_QWORD *)(HalpInterruptController + 16), v37, &v44, v11, v36);
if( (v52 & 0x200) != 0 )
_enable();
return v13;
}
*(_DWORD *)&Affinity.Count = 1310721;
memset((INT64)&Affinity.Reserved, 0i64);
KeAddProcessorAffinityEx(&Affinity, *((_DWORD *)KeGetPcr() + 105));
Result = 0i64;
memset((INT64)&v49, 0i64);
v35 = 0i64;
v34 = 0i64;
if( qword_140C4A1E8 )
{
LODWORD(v13) = qword_140C4A1E8(&Affinity, v11);
return v13;
}
LODWORD(v13) = (unsigned __int16)HalpInterruptPhysicalTargets;
if( (unsigned __int16)HalpInterruptPhysicalTargets >= Affinity.Count )
LODWORD(v13) = Affinity.Count;
v48 = v13;
for( i = 0; i < v48; v51[v16] = v13 )
{
v15 = i++;
v16 = v15;
v13 = Affinity.Bitmap[v15] & qword_140C4B7A8[v15];
}
v49 = 20;
for( j = 0; i < v49; v51[v13] = 0i64 )
v13 = i++;
v17 = v52;
if( HalpInterruptClusterModeEnabled )
{
v18 = (unsigned int *)HalpInterruptClusterData;
ProcNumber = 0;
if( HalpInterruptClusterData < (unsigned __int64)HalpInterruptClusterDataEnd )
{
do
{
LODWORD(v13) = KeAndGroupAffinityEx(&Affinity, (_GROUP_AFFINITY *)(v18 + 2), &Result);
if( (_DWORD)v13 )
{
Mask = Result.Mask;
v20 = 0;
LODWORD(v34) = 6;
v21 = 0;
*((_QWORD *)&v34 + 1) = *v18;
ProcNumber.Group = Result.Group;
for( ProcNumber.Number = 0; Mask; ProcNumber.Number = v21 )
{
if( (Mask & 1) != 0 )
{
v20 |= *(_DWORD *)(HalpInterruptTargets
+ 24i64 * (unsigned int)KeGetProcessorIndexFromNumber(&ProcNumber)
+ 12);
HIDWORD(v34) = v20;
}
++v21;
Mask >>= 1;
}
v38[0] = -1;
v38[1] = 1;
v39[1] = *(_DWORD *)(HalpInterruptIpiLines + 20);
v39[0] = *(_DWORD *)(HalpInterruptIpiLines + 16);
v22 = *(__int64(__fastcall **)(_QWORD, int *, __int128 *, _QWORD, int *))(HalpInterruptController + 120);
_disable();
LODWORD(v13) = v22(*(_QWORD *)(HalpInterruptController + 16), v39, &v34, v11, v38);
if( (v17 & 0x200) != 0 )
_enable();
if( (v13 & 0x80000000) != 0i64 )
return v13;
}
v18 += 6;
}
while( (unsigned __int64)v18 < HalpInterruptClusterDataEnd );
}
LABEL_39:
v28 = v51[0];
LOWORD(v29) = 0;
while( v28 )
{
LABEL_43:
_BitScanForward64(&v30, v28);
LODWORD(v34) = 4;
v28 &= ~(1i64 << v30);
DWORD2(v34) = *(_DWORD *)(HalpInterruptTargets
+ 24i64
* (unsigned int)KiProcessorNumberToIndexMappingTable[64 * (unsigned __int16)v29
+ (unsigned __int8)v30]
+ 8);
v43[1] = *(_DWORD *)(HalpInterruptIpiLines + 20);
v43[0] = *(_DWORD *)(HalpInterruptIpiLines + 16);
v31 = *(__int64(__fastcall **)(_QWORD, int *, __int128 *, _QWORD, int *))(HalpInterruptController + 120);
v42[0] = -1;
v42[1] = 1;
_disable();
LODWORD(v13) = v31(*(_QWORD *)(HalpInterruptController + 16), v43, &v34, v11, v42);
if( (v17 & 0x200) != 0 )
_enable();
if( (v13 & 0x80000000) != 0i64 )
return v13;
}
while( 1 )
{
v29 = (unsigned __int16)(v29 + 1);
if( (unsigned int)v29 >= v48 )
return v13;
v28 = v51[v29];
if( v28 )
goto LABEL_43;
}
}
if( HalpInterruptPhysicalModeOnly )
goto LABEL_39;
v23 = Affinity.Bitmap[0];
LOWORD(v24) = 0;
LODWORD(v34) = 5;
DWORD2(v34) = 0;
while( v23 )
{
LABEL_33:
_BitScanForward64(&v25, v23);
v23 &= ~(1i64 << v25);
v26 = (unsigned __int8)v25 + ((unsigned __int16)v24 << 6);
LODWORD(v13) = HalpInterruptTargets;
if( *(_DWORD *)(HalpInterruptTargets + 24i64 * (unsigned int)KiProcessorNumberToIndexMappingTable[v26]) == 5 )
{
LODWORD(v13) = *(_DWORD *)(HalpInterruptTargets
+ 24i64 * (unsigned int)KiProcessorNumberToIndexMappingTable[v26]
+ 8);
DWORD2(v34) |= v13;
}
}
while( 1 )
{
v24 = (unsigned __int16)(v24 + 1);
if( (unsigned int)v24 >= Affinity.Count )
break;
v23 = Affinity.Bitmap[v24];
if( v23 )
goto LABEL_33;
}
if( !DWORD2(v34) )
goto LABEL_39;
v40[0] = -1;
v40[1] = 1;
v41[1] = *(_DWORD *)(HalpInterruptIpiLines + 20);
v41[0] = *(_DWORD *)(HalpInterruptIpiLines + 16);
v27 = *(__int64(__fastcall **)(_QWORD, int *, __int128 *, _QWORD, int *))(HalpInterruptController + 120);
_disable();
LODWORD(v13) = v27(*(_QWORD *)(HalpInterruptController + 16), v41, &v34, v11, v40);
if( (v17 & 0x200) != 0 )
_enable();
if( (v13 & 0x80000000) == 0i64 )
goto LABEL_39;
return v13;
}Referenced by:
KeClockInterruptNotify
KiCheckForTimerExpiration
KiDetachProcess
KiDirectSwitchThread
KiInsertQueueDpc
KiIpiInterrupt
KiSpuriousDispatchNoEOI
KiSwInterrupt
KiUnstackDetachProcess
KxIsrLinkage
SwapContext