From ebbc730fc30899221ec7fc0eabb551d2dac3f785 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Tue, 19 Oct 2010 17:07:21 +0000 Subject: [PATCH] spurious and error interrupt apic handlers - fixed spurious and error interrupt handlers - not to hog the system the warning isn't reported every time, just once every 100 times, similarly for the spurious PIC interrupts --- kernel/arch/i386/apic.c | 19 +++++++++++++------ kernel/arch/i386/apic_asm.S | 6 ++++++ kernel/arch/i386/apic_asm.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index b4358e467..b5246f425 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -715,16 +715,23 @@ PUBLIC int lapic_enable(unsigned cpu) return 1; } -PRIVATE void apic_spurios_intr(void) +PUBLIC void apic_spurios_intr_handler(void) { - printf("WARNING spurious interrupt\n"); - for(;;); + static unsigned x; + + x++; + if (x == 1 || (x % 100) == 0) + printf("WARNING spurious interrupt(s) %d on cpu %d\n", x, cpuid); } -PRIVATE void apic_error_intr(void) +PUBLIC void apic_error_intr_handler(void) { - printf("WARNING local apic error interrupt\n"); - for(;;); + static unsigned x; + + x++; + if (x == 1 || (x % 100) == 0) + printf("WARNING apic error (0x%x) interrupt(s) %d on cpu %d\n", + lapic_errstatus(), x, cpuid); } PRIVATE struct gate_table_s gate_table_ioapic[] = { diff --git a/kernel/arch/i386/apic_asm.S b/kernel/arch/i386/apic_asm.S index 8dca5b7e3..ec51950ed 100644 --- a/kernel/arch/i386/apic_asm.S +++ b/kernel/arch/i386/apic_asm.S @@ -67,6 +67,12 @@ ENTRY(apic_hwint##irq) \ ENTRY(lapic_timer_int_handler) lapic_intr(_C_LABEL(timer_int_handler)) +ENTRY(apic_spurios_intr) + lapic_intr(_C_LABEL(apic_spurios_intr_handler)) + +ENTRY(apic_error_intr) + lapic_intr(_C_LABEL(apic_error_intr_handler)) + #ifdef CONFIG_SMP ENTRY(apic_ipi_sched_intr) diff --git a/kernel/arch/i386/apic_asm.h b/kernel/arch/i386/apic_asm.h index cf398e629..ff06334da 100644 --- a/kernel/arch/i386/apic_asm.h +++ b/kernel/arch/i386/apic_asm.h @@ -72,6 +72,8 @@ _PROTOTYPE( void apic_hwint63, (void) ); /* The local APIC timer tick handlers */ _PROTOTYPE(void lapic_timer_int_handler, (void)); +_PROTOTYPE(void apic_spurios_intr, (void)); +_PROTOTYPE(void apic_error_intr, (void)); #endif -- 2.44.0