KiInvokeInterruptServiceRoutine

bool __fastcall KiInvokeInterruptServiceRoutine(__int64 a1, unsigned __int8 CurrentIrql, int a3){
  unsigned __int64 v6; 
  UINT8 v7; 
  bool v8; 
  _ETHREAD *CurrentThread; 
  UINT8 v10; 
  UINT8 v11; 
  char v13; 
  __int128 Object; 
  __int128 v15; 
  _BYTE v16[4]; 
  int v17; 
  __int64 v18[6]; 
  __int16 v19; 
  int v20; 
  _KDPC result; 
  LARGE_INTEGER v22[2]; 
  __int128 v23; 
  *(_OWORD *)&v22[0].LowPart = 0i64;
  v23 = 0i64;
  Object = 0i64;
  v15 = 0i64;
  memset((INT64)&result, 0i64);
  memset((INT64)v16, 0i64);
  v6 = *(unsigned __int8 *)(a1 + 93);
  v7 = 1;
  v13 = 0;
  v8 = 0;
  if( (_BYTE)v6 )
  {
    if( CurrentIrql != (_BYTE)v6 )
    {
      CurrentIrql = KeGetCurrentIrql();
      __writecr8(v6);
    }
    if( ((*(_QWORD *)(a1 + 72) + 3i64) & 0xFFFFFFFFFFFFFFFDui64) == 0 )
      v7 = 0;
  }
  else
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --*((_WORD *)CurrentThread + 242);
    KeWaitForSingleObject(*(PVOID *)(a1 + 128), Executive, 0, 0, 0i64);
    v8 = (PerfGlobalGroupMask & 0x400000000000i64) != 0;
    if( (_BYTE)KdDebuggerEnabled && KiPassiveWatchdogTimeout )
    {
      *((_QWORD *)&v15 + 1) = a1;
      *(_QWORD *)&v15 = (char *)&Object + 8;
      LOWORD(Object) = 1;
      *((_QWORD *)&Object + 1) = (char *)&Object + 8;
      BYTE2(Object) = 6;
      v18[1] = (__int64)v18;
      DWORD1(Object) = 0;
      v18[0] = (__int64)v18;
      result.DeferredRoutine = (void(__fastcall *)(_KDPC *, void *, void *, void *))KiPassiveIsrWatchdog;
      result.DeferredContext = &Object;
      v16[0] = 8;
      v17 = 0;
      v18[2] = 0i64;
      v20 = 0;
      v19 = 0;
      result.TargetInfoAsUlong = 275;
      result.DpcData = 0i64;
      result.ProcessorHistory = 0i64;
      KiSetTimerEx((_KTIMER *)v16, (_LARGE_INTEGER)(-10000000i64 * KiPassiveWatchdogTimeout), 0i64, 0, &result);
      v13 = 1;
    }
    v7 = 1;
  }
  *(_QWORD *)(a1 + 152) = KeGetCurrentThread();
  if( v8 )
    EtwGetKernelTraceTimestamp(v22, 0x20004000ui64);
  v10 = KiCallInterruptServiceRoutine((_KINTERRUPT *)a1, v7);
  v11 = v10;
  if( v8 )
    PerfInfoLogInterrupt(a1, (a3 << 8) | (unsigned int)v10, (INT64)v22);
  if( v13 && !KeCancelTimer((PKTIMER)v16) )
    KeWaitForSingleObject(&Object, Executive, 0, 0, 0i64);
  *(_QWORD *)(a1 + 152) = 0i64;
  if( (_BYTE)v6 )
  {
    if( CurrentIrql != (_BYTE)v6 )
      __writecr8(CurrentIrql);
  }
  else
  {
    KeSetEvent(*(PRKEVENT *)(a1 + 128), 0);
    KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
  }
  return v11 == 1;
}

Referenced by:

KiInterruptDispatchCommon