HalpInterruptUpdateLocalUnitIdentifier
INT64 __fastcall HalpInterruptUpdateLocalUnitIdentifier(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
int v4;
unsigned int v6;
int v8;
ULONG_PTR v9;
char v11;
__int64 v12;
__int64 ProcessorIndexFromNumber;
__int64 v14;
__int64(__fastcall *v15)(_QWORD, int *, INT64, __int64);
int v16;
unsigned int v17;
unsigned int v18;
int *v19;
_INTERRUPT_PROBLEM v20;
unsigned __int64 v21;
unsigned __int64 i;
__int64 v23;
int v24;
UINT64 SourceLine;
int v26;
v26 = a2;
v4 = a2;
v6 = 0;
v8 = a1;
if( !(_DWORD)HalpInterruptProcessorCount )
{
LABEL_5:
LODWORD(SourceLine) = 1009;
HalpInterruptSetProblemEx(
0i64,
InterruptProblemInvalidProcessor,
0i64,
"minkernel\\hals\\lib\\interrupts\\common\\replace.c",
SourceLine);
return 3221226021i64;
}
v9 = HalpInterruptProcessorState;
while( *(_DWORD *)v9 != (_DWORD)a1 )
{
++v6;
v9 += 64i64;
if( v6 >= (unsigned int)HalpInterruptProcessorCount )
goto LABEL_5;
}
v11 = *(_BYTE *)(v9 + 13);
*(_DWORD *)v9 = v4;
ProcessorIndexFromNumber = (unsigned int)KeGetProcessorIndexFromNumber((_PROCESSOR_NUMBER *)((v9 + 16) & -(__int64)(v11 != 0)));
v14 = HalpInterruptTargets + 24 * ProcessorIndexFromNumber;
*(_OWORD *)a3 = *(_OWORD *)v14;
*(_QWORD *)(a3 + 16) = *(_QWORD *)(v14 + 16);
if( *(_DWORD *)v14 == 4 )
{
*(_DWORD *)(v14 + 8) = v4;
v4 = v26;
}
v15 = *(__int64(__fastcall **)(_QWORD, int *, INT64, __int64))(HalpInterruptController + 144);
if( v15 )
{
LOBYTE(v12) = 1;
v16 = v15(*(_QWORD *)(HalpInterruptController + 16), &v26, a4, v12);
if( v16 < 0 )
{
LODWORD(SourceLine) = 1044;
HalpInterruptSetProblemEx(
(_REGISTERED_INTERRUPT_CONTROLLER *)HalpInterruptController,
InterruptProblemConvertIdFailed,
(unsigned int)v16,
"minkernel\\hals\\lib\\interrupts\\common\\replace.c",
SourceLine);
return v17;
}
v14 = HalpInterruptTargets + 24 * ProcessorIndexFromNumber;
*(_OWORD *)v14 = *(_OWORD *)a4;
*(_QWORD *)(v14 + 16) = *(_QWORD *)(a4 + 16);
v4 = v26;
}
v18 = 0;
if( HalpInterruptDynamicProcessorCount )
{
v19 = (int *)HalpInterruptDynamicProcessorState;
while( *v19 != v8 )
{
++v18;
v19 += 16;
if( v18 >= HalpInterruptDynamicProcessorCount )
goto LABEL_18;
}
*v19 = v4;
}
LABEL_18:
v20 = InterruptProblemIpiDestinationUpdateFailed;
if( *(_DWORD *)a3 == 6 )
{
v21 = HalpInterruptClusterData;
if( HalpInterruptClusterData >= (unsigned __int64)HalpInterruptClusterDataEnd )
{
LABEL_22:
LODWORD(SourceLine) = 1099;
HalpInterruptSetProblemEx(
0i64,
InterruptProblemIpiDestinationUpdateFailed,
0i64,
"minkernel\\hals\\lib\\interrupts\\common\\replace.c",
SourceLine);
}
else
{
while( *(_DWORD *)v21 != *(_DWORD *)(a3 + 8) )
{
v21 += 24i64;
if( v21 >= HalpInterruptClusterDataEnd )
goto LABEL_22;
}
v23 = *(_QWORD *)(v21 + 8) & ~(1i64 << (KiProcessorIndexToNumberMappingTable[ProcessorIndexFromNumber] & 0x3F));
*(_QWORD *)(v21 + 8) = v23;
if( !v23 )
*(_DWORD *)v21 = -1;
}
}
*(_OWORD *)a4 = *(_OWORD *)v14;
*(_QWORD *)(a4 + 16) = *(_QWORD *)(v14 + 16);
if( *(_DWORD *)a4 == 6 )
{
for( i = HalpInterruptClusterData; ; i += 24i64 )
{
if( i >= HalpInterruptClusterDataEnd )
{
LODWORD(SourceLine) = 1134;
HalpInterruptSetProblemEx(0i64, v20, 0i64, "minkernel\\hals\\lib\\interrupts\\common\\replace.c", SourceLine);
return 0i64;
}
if( *(_DWORD *)i == -1 || *(_DWORD *)i == *(_DWORD *)(a4 + 8) )
break;
}
v24 = KiProcessorIndexToNumberMappingTable[ProcessorIndexFromNumber];
*(_DWORD *)i = *(_DWORD *)(a4 + 8);
*(_QWORD *)(i + 8) |= 1i64 << (v24 & 0x3F);
}
return 0i64;
}Referenced by:
HalpInterruptSwapProcessorIdentifiers