KiConnectSecondaryInterrupt

VOID __fastcall KiConnectSecondaryInterrupt(_KINTERRUPT *Interrupt){
  unsigned __int8 Irql; 
  __int64 v3; 
  unsigned __int8 SynchronizeIrql; 
  __int64 v5; 
  __int64 v6; 
  __int64 v7; 
  UINT8 OldIrql; 

  OldIrql = 0;
  if( KiSecondaryInterruptServicesEnabled )
  {
    Irql = Interrupt->Irql;
    v3 = Interrupt->Vector - 256;
    if( (unsigned int)v3 <= 0xFF && Irql <= 0xCu && Interrupt->Number < (unsigned int)KeNumberProcessors_0 )
    {
      SynchronizeIrql = Interrupt->SynchronizeIrql;
      if( SynchronizeIrql >= Irql || !SynchronizeIrql )
      {
        v5 = KiGlobalSecondaryIDT + 48 * v3;
        KiAcquireSecondaryPassiveConnectLock((_KSECONDARY_IDT_ENTRY *)v5);
        KiAcquireSecondaryInterruptConnectLock((UINT64 *)v5, &OldIrql);
        if( Interrupt->Connected )
        {
LABEL_17:
          KxReleaseSpinLock((UINT64 *)v5);
          __writecr8(OldIrql);
          KeSetEvent((PRKEVENT)(v5 + 8), 0, 0);
          KeLeaveCriticalRegionThread(KeGetCurrentThread());
          return;
        }
        v6 = *(_QWORD *)(v5 + 40);
        if( v6 )
        {
          if( !Interrupt->ShareVector )
            goto LABEL_16;
          if( !*(_BYTE *)(v6 + 100) )
            goto LABEL_16;
          if( *(_DWORD *)(v6 + 108) != Interrupt->Mode )
            goto LABEL_16;
          KiInsertInterruptObjectOrdered(*(PROCESSOR_NUMBER **)(v5 + 40), (INT64)Interrupt);
          if( *(_BYTE *)(v7 + 93) || !Interrupt->SynchronizeIrql )
            goto LABEL_16;
        }
        else
        {
          Interrupt->InterruptListEntry.Blink = &Interrupt->InterruptListEntry;
          Interrupt->InterruptListEntry.Flink = &Interrupt->InterruptListEntry;
          *(_BYTE *)(v5 + 32) = 0;
        }
        *(_QWORD *)(v5 + 40) = Interrupt;
LABEL_16:
        Interrupt->Connected = 1;
        goto LABEL_17;
      }
    }
  }
}

Referenced by:

KeConnectInterrupt