summaryrefslogtreecommitdiff
path: root/i386/i386at/interrupt.S
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-02-25 21:28:37 +0000
committerThomas Bushnell <thomas@gnu.org>1997-02-25 21:28:37 +0000
commitf07a4c844da9f0ecae5bbee1ab94be56505f26f7 (patch)
tree12b07c7e578fc1a5f53dbfde2632408491ff2a70 /i386/i386at/interrupt.S
Initial source
Diffstat (limited to 'i386/i386at/interrupt.S')
-rw-r--r--i386/i386at/interrupt.S48
1 files changed, 48 insertions, 0 deletions
diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S
new file mode 100644
index 0000000..25cd66e
--- /dev/null
+++ b/i386/i386at/interrupt.S
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1995 Shantanu Goel
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE AUTHOR ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. THE AUTHOR DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ */
+
+#include <mach/machine/asm.h>
+
+#include "ipl.h"
+#include "pic.h"
+#include "i386asm.h"
+
+#define READ_ISR (OCW_TEMPLATE|READ_NEXT_RD|READ_IS_ONRD)
+
+/*
+ * Generic interrupt handler.
+ *
+ * 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:
+ shll $2,%ecx /* irq * 4 */
+ movl EXT(intpri)(%ecx),%edx /* get new ipl */
+ call spl /* 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 */
+ cli /* XXX no more nested interrupts */
+ addl $4,%esp /* pop previous ipl */
+ ret /* return */