Show the IRQ number from the actual interrupt vector in addition to the
value
read from the ISR (the In-Service Register of the 8259A PIC) in the debug
output, generated by the unused IRQ handlers. This helps e.g. distinguishing
real IRQs from spurious interrupts, generated by buggy (or badly configured)
hardware.
Signed-off-by: Nikolay Nikolov <nickysn(a)users.sourceforge.net>
---
src/hw/pic.c | 108
+++++++++++++++++++++++++++++++++++++++++++++++++++++---
src/post.c | 20 ++++++++---
src/romlayout.S | 18 ++++++++--
3 files changed, 135 insertions(+), 11 deletions(-)
diff --git a/src/hw/pic.c b/src/hw/pic.c
index a13564a..dc9fe21 100644
--- a/src/hw/pic.c
+++ b/src/hw/pic.c
@@ -99,17 +99,115 @@ pic_isr2_read(void)
return inb(PORT_PIC2_CMD);
}
-// Handler for otherwise unused hardware irqs.
+// Handlers for otherwise unused hardware irqs.
void VISIBLE16
-handle_hwpic1(void)
+handle_hwpic1_irq0(void)
{
- dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=%x\n", pic_isr1_read());
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=0 isr=%x\n",
pic_isr1_read());
pic_eoi1();
}
void VISIBLE16
-handle_hwpic2(void)
+handle_hwpic1_irq1(void)
{
- dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=%x\n", pic_isr2_read());
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=1 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic1_irq2(void)
+{
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=2 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic1_irq3(void)
+{
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=3 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic1_irq4(void)
+{
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=4 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic1_irq5(void)
+{
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=5 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic1_irq6(void)
+{
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=6 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic1_irq7(void)
+{
+ dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=7 isr=%x\n",
pic_isr1_read());
+ pic_eoi1();
+}
+
+void VISIBLE16
+handle_hwpic2_irq8(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=8 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq9(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=9 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq10(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=10 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq11(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=11 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq12(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=12 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq13(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=13 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq14(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=14 isr=%x\n",
pic_isr2_read());
+ pic_eoi2();
+}
+
+void VISIBLE16
+handle_hwpic2_irq15(void)
+{
+ dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=15 isr=%x\n",
pic_isr2_read());
pic_eoi2();
}
diff --git a/src/post.c b/src/post.c
index f93106a..12aa4f8 100644
--- a/src/post.c
+++ b/src/post.c
@@ -40,10 +40,22 @@ ivt_init(void)
SET_IVT(i, FUNC16(entry_iret_official));
// Initialize all hw vectors to a default hw handler.
- for (i=BIOS_HWIRQ0_VECTOR; i<BIOS_HWIRQ0_VECTOR+8; i++)
- SET_IVT(i, FUNC16(entry_hwpic1));
- for (i=BIOS_HWIRQ8_VECTOR; i<BIOS_HWIRQ8_VECTOR+8; i++)
- SET_IVT(i, FUNC16(entry_hwpic2));
+ SET_IVT(BIOS_HWIRQ0_VECTOR, FUNC16(entry_hwpic1_irq0));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+1, FUNC16(entry_hwpic1_irq1));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+2, FUNC16(entry_hwpic1_irq2));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+3, FUNC16(entry_hwpic1_irq3));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+4, FUNC16(entry_hwpic1_irq4));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+5, FUNC16(entry_hwpic1_irq5));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+6, FUNC16(entry_hwpic1_irq6));
+ SET_IVT(BIOS_HWIRQ0_VECTOR+7, FUNC16(entry_hwpic1_irq7));
+ SET_IVT(BIOS_HWIRQ8_VECTOR, FUNC16(entry_hwpic2_irq8));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+1, FUNC16(entry_hwpic2_irq9));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+2, FUNC16(entry_hwpic2_irq10));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+3, FUNC16(entry_hwpic2_irq11));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+4, FUNC16(entry_hwpic2_irq12));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+5, FUNC16(entry_hwpic2_irq13));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+6, FUNC16(entry_hwpic2_irq14));
+ SET_IVT(BIOS_HWIRQ8_VECTOR+7, FUNC16(entry_hwpic2_irq15));
// Initialize software handlers.
SET_IVT(0x02, FUNC16(entry_02));
diff --git a/src/romlayout.S b/src/romlayout.S
index c4a4635..50a44b9 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -568,8 +568,22 @@ irqentry_arg:
DECL_IRQ_ENTRY 70
DECL_IRQ_ENTRY 74
DECL_IRQ_ENTRY 75
- DECL_IRQ_ENTRY hwpic1
- DECL_IRQ_ENTRY hwpic2
+ DECL_IRQ_ENTRY hwpic1_irq0
+ DECL_IRQ_ENTRY hwpic1_irq1
+ DECL_IRQ_ENTRY hwpic1_irq2
+ DECL_IRQ_ENTRY hwpic1_irq3
+ DECL_IRQ_ENTRY hwpic1_irq4
+ DECL_IRQ_ENTRY hwpic1_irq5
+ DECL_IRQ_ENTRY hwpic1_irq6
+ DECL_IRQ_ENTRY hwpic1_irq7
+ DECL_IRQ_ENTRY hwpic2_irq8
+ DECL_IRQ_ENTRY hwpic2_irq9
+ DECL_IRQ_ENTRY hwpic2_irq10
+ DECL_IRQ_ENTRY hwpic2_irq11
+ DECL_IRQ_ENTRY hwpic2_irq12
+ DECL_IRQ_ENTRY hwpic2_irq13
+ DECL_IRQ_ENTRY hwpic2_irq14
+ DECL_IRQ_ENTRY hwpic2_irq15
// int 18/19 are special - they reset stack and call into
32bit mode.
DECLFUNC entry_19
--
2.14.3