HalpInterruptSetLineState
NTSTATUS __stdcall HalpInterruptSetLineState(
_INTERRUPT_LINE *Line,
PVOID Vector,
_KINTERRUPT_MODE Irql,
_KINTERRUPT_POLARITY TriggerMode,
_KINTERRUPT_POLARITY Polarity,
_INTERRUPT_LINE *Destination,
UINT64 Flags){
unsigned __int64 v7;
char v8;
_INTERRUPT_LINE v9;
_INTERRUPT_LINE *v10;
_REGISTERED_INTERRUPT_CONTROLLER *v11;
INT64 v12;
_LIST_ENTRY *Lines;
_LIST_ENTRY *v14;
_LIST_ENTRY *Flink;
char v16;
__int64 v17;
bool v18;
__int128 v19;
__int128 v20;
__int128 v21;
NTSTATUS BestRouting;
NTSTATUS Priority;
char v24;
_LIST_ENTRY *Blink;
__int128 v27;
__int64 v28;
__int64 v29;
__int128 v30;
__int128 v31;
int v32[8];
UINT64 SourceLine;
__int128 v34;
_LIST_ENTRY v35;
__int128 v36;
__int128 v37;
__int64 v38;
_INTERRUPT_LINE Linea;
char v40;
_KINTERRUPT_MODE TriggerModea;
unsigned int v42;
TriggerModea = TriggerMode;
v40 = Irql;
v42 = 0;
v7 = (unsigned int)Vector;
if( Polarity == InterruptActiveBoth )
{
v8 = 1;
Polarity = InterruptActiveLow;
}
else if( Polarity == InterruptActiveBothTriggerHigh )
{
v8 = 1;
Polarity = InterruptActiveHigh;
}
else
{
v8 = 0;
}
Linea = *Line;
HalpInterruptApplyOverrides(&Linea, &Polarity, &TriggerModea);
v9.UnitId = Linea.UnitId;
v10 = (_INTERRUPT_LINE *)Flags;
while( 1 )
{
v11 = HalpInterruptLookupController(v9.UnitId);
v12 = (INT64)v11;
if( !v11 )
{
*(&CmpDummyThreadEvent + 1789) = 17;
return -1073741275;
}
if( (v11->Flags & 2) != 0 )
KeBugCheckEx(0x5Cu, (PVOID)0x200, (PVOID)*(&CmpDummyThreadEvent + 1789), v11, (PVOID)0x7931847);
Lines = HalpInterruptFindLines((unsigned int *)&Linea);
v14 = Lines;
if( !Lines )
{
*(_DWORD *)(v12 + 296) = 0;
*(_QWORD *)(v12 + 304) = "minkernel\\hals\\lib\\interrupts\\common\\connect.c";
*(&CmpDummyThreadEvent + 1789) = 18;
*(_DWORD *)(v12 + 292) = 18;
*(_DWORD *)(v12 + 312) = 2232;
return -1073741275;
}
Flink = Lines[3].Flink;
if( LOBYTE(Flink[v42].Flink) )
{
*(_DWORD *)(v12 + 296) = 0;
*(_QWORD *)(v12 + 304) = "minkernel\\hals\\lib\\interrupts\\common\\connect.c";
*(&CmpDummyThreadEvent + 1789) = 19;
BestRouting = -1073741811;
*(_DWORD *)(v12 + 292) = 19;
*(_DWORD *)(v12 + 312) = 2245;
return BestRouting;
}
v16 = 1;
v17 = (__int64)v14[2].Blink + 56 * v42;
v18 = BYTE4(Flink[v42].Blink) == 0;
v19 = *(_OWORD *)(v17 + 16);
v35 = *(_LIST_ENTRY *)v17;
v20 = *(_OWORD *)(v17 + 32);
v36 = v19;
*(_QWORD *)&v19 = *(_QWORD *)(v17 + 48);
v37 = v20;
v21 = (__int128)Flink[v42];
v38 = v19;
v34 = v21;
if( v18 )
{
BestRouting = HalpInterruptDestinationToTarget(v42, (__int64)Destination, v17 + 24);
if( BestRouting < 0 )
{
*(_DWORD *)(v12 + 296) = BestRouting;
*(&CmpDummyThreadEvent + 1789) = 22;
*(_DWORD *)(v12 + 292) = 22;
*(_QWORD *)(v12 + 304) = "minkernel\\hals\\lib\\interrupts\\common\\connect.c";
*(_DWORD *)(v12 + 312) = 2322;
goto LABEL_17;
}
BestRouting = HalpInterruptFindBestRouting(&Linea, *v10, (_INTERRUPT_LINE *)(v17 + 16));
if( BestRouting < 0 )
goto LABEL_31;
*(_DWORD *)v17 = Polarity;
*(_DWORD *)(v17 + 8) = TriggerModea;
*(_BYTE *)(v17 + 4) = v8;
*(_DWORD *)(v17 + 12) = 16;
*(_DWORD *)(v17 + 48) = v7;
Priority = HalpInterruptGetPriority(v12, v7);
v24 = v40;
*(_DWORD *)(v17 + 52) = Priority;
*((_BYTE *)&CmpDummyThreadEvent + ((unsigned __int64)(unsigned __int8)v7 >> 4) + 7040) = v24;
}
else
{
if( !byte_140C4A319
&& (*(_DWORD *)(v17 + 48) != (_DWORD)v7
|| *(_DWORD *)(v17 + 8) != TriggerModea
|| *(_DWORD *)v17 != Polarity
|| *(_BYTE *)(v17 + 4) != v8) )
{
LODWORD(SourceLine) = 2287;
HalpInterruptSetProblemEx(
(_REGISTERED_INTERRUPT_CONTROLLER *)v12,
InterruptProblemConnectionDataBaitAndSwitch,
0i64,
"minkernel\\hals\\lib\\interrupts\\common\\connect.c",
SourceLine);
KeBugCheckEx(0x5Cu, (PVOID)0x202, (PVOID)v17, (PVOID)*(unsigned int *)(v17 + 48), (PVOID)v7);
}
*(_DWORD *)(v17 + 12) |= 0x10u;
}
_InterlockedOr(v32, 0);
BestRouting = HalpInterruptSetLineStateInternal(
(_REGISTERED_INTERRUPT_CONTROLLER *)v12,
&Linea,
(_INTERRUPT_LINE_STATE *)v17);
if( BestRouting < 0 )
goto LABEL_31;
v16 = 0;
if( *(_DWORD *)(v17 + 20) == v10->Line && *(_DWORD *)(v17 + 16) == v10->UnitId )
break;
v9 = *(_INTERRUPT_LINE *)(v17 + 16);
Linea = v9;
}
BestRouting = 0;
LABEL_17:
if( BestRouting < 0 && v16 )
{
LABEL_31:
Blink = v14[2].Blink;
v27 = v36;
v28 = 56i64 * v42;
v29 = v42;
*(_LIST_ENTRY *)((char *)Blink + v28) = v35;
v30 = v37;
*(_LIST_ENTRY *)((char *)&Blink[1] + v28) = (_LIST_ENTRY)v27;
*(_QWORD *)&v27 = v38;
*(_LIST_ENTRY *)((char *)&Blink[2] + v28) = (_LIST_ENTRY)v30;
v31 = v34;
*(_LIST_ENTRY **)((char *)&Blink[3].Flink + v28) = (_LIST_ENTRY *)v27;
v14[3].Flink[v29] = (_LIST_ENTRY)v31;
}
return BestRouting;
}Referenced by:
HalEnableInterrupt
HalpInterruptEnableNmi
HalpInterruptEnablePerformanceEvents
HalpTimerConfigureInterrupt
HalpTimerEnableHypervisorTimer