KiCallInterruptServiceRoutine

UINT8 __stdcall KiCallInterruptServiceRoutine(_KINTERRUPT *Interrupt, UINT8 AcquireSpinlock){
  _BYTE *RedirectObject; 
  struct _KPRCB *CurrentPrcb; 
  __int64 v6; 
  unsigned __int64 v7; 
  unsigned __int64 v8; 
  unsigned __int8 v9; 
  unsigned __int64 v10; 
  unsigned int v11; 
  unsigned __int64 v12; 
  unsigned __int64 *ActualLock; 
  int v15; 
  unsigned int v16; 
  unsigned int FirstSetRightGroupAffinity; 
  unsigned __int64 v18; 
  if( Interrupt->Vector - 48 <= 0x9F && !KiForceIdleDisabled )
  {
    if( (_DWORD)KiForceIdleState == 4 )
    {
      KiResetForceIdle(1i64, 0);
    }
    else if( (unsigned int)(KiForceIdleState - 1) <= 1 )
    {
      KiCheckAndRearmForceIdle();
    }
  }
  if( !Interrupt->SynchronizeIrql )
  {
    v9 = Interrupt->ServiceRoutine(Interrupt, Interrupt->ServiceContext);
    return v9 != 0;
  }
  RedirectObject = Interrupt->RedirectObject;
  if( RedirectObject && RedirectObject[16] )
  {
    v15 = 0;
    v16 = KiProcessorIndexToNumberMappingTable[*((unsigned int *)KeGetPcr() + 105)];
    if( v16 >> 6 == *((unsigned __int16 *)RedirectObject + 4) )
      v15 = 1;
    if( ((unsigned int)(*(_QWORD *)RedirectObject >> (v16 & 0x3F)) & v15) == 0 )
    {
      FirstSetRightGroupAffinity = KeFindFirstSetRightGroupAffinity((_GROUP_AFFINITY *)Interrupt->RedirectObject);
      KiIntRedirectQueueRequestOnProcessor(FirstSetRightGroupAffinity, Interrupt->Vector);
      return 2;
    }
  }
  CurrentPrcb = KeGetCurrentPrcb();
  v6 = *((_QWORD *)CurrentPrcb + 1458);
  Interrupt->IsrDpcStats.IsrActive = 1;
  *((_QWORD *)CurrentPrcb + 1458) = &Interrupt->IsrDpcStats;
  v7 = __rdtsc();
  Interrupt->IsrDpcStats.IsrTimeStart = v7;
  v8 = v7;
  if( AcquireSpinlock )
  {
    ActualLock = Interrupt->ActualLock;
    if( _interlockedbittestandset64((volatile signed __int32 *)ActualLock, 0i64) )
      KxWaitForSpinLockAndAcquire(ActualLock);
  }
  v9 = Interrupt->ServiceRoutine(Interrupt, Interrupt->ServiceContext);
  if( AcquireSpinlock )
    _InterlockedAnd64((volatile signed __int64 *)Interrupt->ActualLock, 0i64);
  v10 = __rdtsc();
  v11 = *((_DWORD *)CurrentPrcb + 7947);
  v12 = v10 - Interrupt->IsrDpcStats.IsrTimeStart;
  if( v11 != Interrupt->IsrDpcStats.DpcWatchdog.SequenceNumber )
  {
    Interrupt->IsrDpcStats.DpcWatchdog.SequenceNumber = v11;
    Interrupt->IsrDpcStats.DpcWatchdog.IsrTime = 0i64;
    Interrupt->IsrDpcStats.DpcWatchdog.IsrCount = 0i64;
    Interrupt->IsrDpcStats.DpcWatchdog.DpcTime = 0i64;
    Interrupt->IsrDpcStats.DpcWatchdog.DpcCount = 0i64;
  }
  Interrupt->IsrDpcStats.IsrTime += v12;
  Interrupt->IsrDpcStats.DpcWatchdog.IsrTime += v12;
  if( v6 != 1 )
  {
    v18 = v10 - v8;
    if( *(_BYTE *)(v6 + 48) )
      *(_QWORD *)(v6 + 8) += v18;
    else
      *(_QWORD *)(v6 + 32) += v18;
  }
  *((_QWORD *)CurrentPrcb + 1458) = v6;
  Interrupt->IsrDpcStats.IsrActive = 0;
  if( v9 )
  {
    ++Interrupt->IsrDpcStats.IsrCount;
    ++Interrupt->IsrDpcStats.DpcWatchdog.IsrCount;
    return v9 != 0;
  }
  return 0;
}

Referenced by:

KiInterruptSubDispatch
KiInterruptSubDispatchNoLock
KiInterruptSubDispatchNoLockNoEtw
KiInvokeInterruptServiceRoutine
KiScanInterruptObjectList