From 5da1aea7ab3cf8634e1ef061a8c6a9873fed4f4e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 27 Feb 2011 05:37:57 +0100 Subject: Acknoledge interrupt after handler call This fixes interrupt overflows when software interrupts processing gets slower than hardware. * i386/i386at/interrupt.S (interrupt): Issue EOI to PICs after having called the interrupt handler and disabled interrupts through cli. --- i386/i386at/interrupt.S | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'i386/i386at/interrupt.S') diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S index 4916903..e238ea4 100644 --- a/i386/i386at/interrupt.S +++ b/i386/i386at/interrupt.S @@ -27,13 +27,8 @@ * On entry, %eax contains the irq number. */ ENTRY(interrupt) - movl %eax,%ecx /* save irq number */ - movb $(NON_SPEC_EOI),%al /* non-specific EOI */ - outb %al,$(PIC_MASTER_ICW) /* ack interrupt to master */ - cmpl $8,%ecx /* do we need to ack slave? */ - jl 1f /* no, skip it */ - outb %al,$(PIC_SLAVE_ICW) -1: + pushl %eax /* save irq number */ + movl %eax,%ecx /* copy irq number */ shll $2,%ecx /* irq * 4 */ movl EXT(intpri)(%ecx),%edx /* get new ipl */ call spl /* set ipl */ @@ -43,6 +38,14 @@ ENTRY(interrupt) call *EXT(ivect)(%ecx) /* call interrupt handler */ addl $4,%esp /* pop unit number */ call splx_cli /* restore previous ipl */ - cli /* XXX no more nested interrupts */ addl $4,%esp /* pop previous ipl */ + cli /* XXX no more nested interrupts */ + popl %eax /* restore irq number */ + movl %eax,%ecx /* copy irq number */ + movb $(NON_SPEC_EOI),%al /* non-specific EOI */ + outb %al,$(PIC_MASTER_ICW) /* ack interrupt to master */ + cmpl $8,%ecx /* do we need to ack slave? */ + jl 1f /* no, skip it */ + outb %al,$(PIC_SLAVE_ICW) +1: ret /* return */ -- cgit v1.2.3