summaryrefslogtreecommitdiff
path: root/i386/i386at/interrupt.S
diff options
context:
space:
mode:
Diffstat (limited to 'i386/i386at/interrupt.S')
-rw-r--r--i386/i386at/interrupt.S84
1 files changed, 64 insertions, 20 deletions
diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S
index e6a6af00..77424b43 100644
--- a/i386/i386at/interrupt.S
+++ b/i386/i386at/interrupt.S
@@ -29,25 +29,38 @@
* Generic interrupt handler.
*
* On entry, %eax contains the irq number.
+ *
+ * Note: kdb_kintr needs to know our stack usage
*/
+
+#define S_REGS 28(%esp)
+#define S_RET 24(%esp)
+#define S_IRQ 20(%esp)
+#define S_IPL 16(%esp)
+
ENTRY(interrupt)
#ifdef APIC
cmpl $255,%eax /* was this a spurious intr? */
- je _no_eoi /* if so, just return */
+ jne 1f
+ ret /* if so, just return */
+1:
#endif
- pushl %eax /* save irq number */
- movl %eax,%ecx /* copy irq number */
- shll $2,%ecx /* irq * 4 */
+ subl $24,%esp /* Two local variables + 4 parameters */
+ movl %eax,S_IRQ /* save irq number */
+
call spl7 /* set ipl */
- movl EXT(iunit)(%ecx),%edx /* get device unit number */
- pushl %eax /* push previous ipl */
- pushl %edx /* push unit number */
- call *EXT(ivect)(%ecx) /* call interrupt handler */
- addl $4,%esp /* pop unit number */
- call splx_cli /* restore previous ipl */
- addl $4,%esp /* pop previous ipl */
- cli /* XXX no more nested interrupts */
- popl %ecx /* restore irq number */
+ movl %eax,S_IPL /* save previous ipl */
+
+ movl S_IRQ,%ecx /* restore irq number */
+
+#if NCPUS > 1
+ cmpl $CALL_PMAP_UPDATE,%ecx /* was this a SMP pmap_update request? */
+ je _call_single
+
+ cmpl $CALL_AST_CHECK,%ecx /* was this a SMP remote -> local ast request? */
+ je _call_local_ast
+#endif
+
#ifndef APIC
movl $1,%eax
shll %cl,%eax /* get corresponding IRQ mask */
@@ -84,15 +97,46 @@ ENTRY(interrupt)
movl EXT(curr_pic_mask),%eax /* restore original mask */
outb %al,$(PIC_MASTER_OCW) /* unmask master */
2:
- ret
#else
- cmpl $16,%ecx /* was this a low ISA intr? */
- jge _no_eoi /* no, must be PCI (let irq_ack handle EOI) */
-_isa_eoi:
- pushl %ecx /* push irq number */
+ movl %ecx,(%esp) /* load irq number as 1st arg */
call EXT(ioapic_irq_eoi) /* ioapic irq specific EOI */
- addl $4,%esp /* pop irq number */
-_no_eoi:
+#endif
+
+ movl S_IPL,%eax
+ movl %eax,4(%esp) /* previous ipl as 2nd arg */
+
+ movl S_RET,%eax
+ movl %eax,8(%esp) /* return address as 3rd arg */
+
+ movl S_REGS,%eax
+ movl %eax,12(%esp) /* address of interrupted registers as 4th arg */
+
+ movl S_IRQ,%eax /* copy irq number */
+
+ shll $2,%eax /* irq * 4 */
+ movl EXT(iunit)(%eax),%edx /* get device unit number */
+ movl %edx,(%esp) /* unit number as 1st arg */
+
+ call *EXT(ivect)(%eax) /* call interrupt handler */
+
+_completed:
+ movl S_IPL,%eax /* restore previous ipl */
+ movl %eax,(%esp)
+ call splx_cli /* restore previous ipl */
+
+ addl $24,%esp /* pop local variables */
ret
+
+#if NCPUS > 1
+_call_single:
+ call EXT(lapic_eoi) /* lapic EOI before the handler to allow extra update */
+ call EXT(pmap_update_interrupt)
+ jmp _completed
+
+_call_local_ast:
+ call EXT(lapic_eoi) /* lapic EOI */
+ call EXT(ast_check) /* AST check on this cpu */
+ jmp _completed
+
#endif
END(interrupt)