Fixed a bug in the HardwareInterrupt handler that would blow the stack if you reenabl...
[mirror_edk2.git] / BeagleBoardPkg / InterruptDxe / HardwareInterrupt.c
index 3e69515..c87d564 100644 (file)
@@ -234,12 +234,16 @@ IrqInterruptHandler (
   \r
   Vector = MmioRead32(INTCPS_SIR_IRQ) & INTCPS_SIR_IRQ_MASK;\r
 \r
+  // Needed to prevent infinite nesting if Time Driver lowers TPL\r
+  MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
+\r
   InterruptHandler = gRegisteredInterruptHandlers[Vector];\r
   if (InterruptHandler != NULL) {\r
     // Call the registered interrupt handler.\r
     InterruptHandler(Vector, SystemContext);\r
   }\r
   \r
+  // Needed to clear after running the handler\r
   MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
 }\r
 \r