[patch 5/6] x86: irqinit - merge math_error_irq and headers

From: Cyrill Gorcunov
Date: Sun Mar 29 2009 - 16:22:23 EST


Though the #include's are to be cleaned up.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
---
arch/x86/kernel/irqinit_32.c | 8 ++++++--
arch/x86/kernel/irqinit_64.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irqinit_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_32.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_32.c
@@ -1,19 +1,23 @@
+#include <linux/linkage.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
+#include <linux/timex.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/init.h>
#include <linux/kernel_stat.h>
#include <linux/sysdev.h>
#include <linux/bitops.h>
+#include <linux/acpi.h>
#include <linux/io.h>
#include <linux/delay.h>

#include <asm/atomic.h>
#include <asm/system.h>
+#include <asm/hw_irq.h>
#include <asm/timer.h>
#include <asm/pgtable.h>
#include <asm/desc.h>
@@ -22,7 +26,7 @@
#include <asm/i8259.h>
#include <asm/traps.h>

-
+#ifdef CONFIG_X86_32
/*
* Note that on a 486, we don't want to do a SIGFPE on an irq13
* as the irq is unreliable, and exception 16 works correctly
@@ -34,7 +38,6 @@
* leads to races. IBM designers who came up with it should
* be shot.
*/
-
static irqreturn_t math_error_irq(int cpl, void *dev_id)
{
outb(0, 0xF0);
@@ -53,6 +56,7 @@ static struct irqaction fpu_irq = {
.mask = CPU_MASK_NONE,
.name = "fpu",
};
+#endif /* CONFIG_X86_32 */

/*
* ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
Index: linux-2.6.git/arch/x86/kernel/irqinit_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irqinit_64.c
+++ linux-2.6.git/arch/x86/kernel/irqinit_64.c
@@ -4,6 +4,7 @@
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
+#include <linux/kprobes.h>
#include <linux/timex.h>
#include <linux/slab.h>
#include <linux/random.h>
@@ -18,11 +19,45 @@
#include <asm/atomic.h>
#include <asm/system.h>
#include <asm/hw_irq.h>
+#include <asm/timer.h>
#include <asm/pgtable.h>
#include <asm/desc.h>
#include <asm/apic.h>
#include <asm/setup.h>
#include <asm/i8259.h>
+#include <asm/traps.h>
+
+#ifdef CONFIG_X86_32
+/*
+ * Note that on a 486, we don't want to do a SIGFPE on an irq13
+ * as the irq is unreliable, and exception 16 works correctly
+ * (ie as explained in the intel literature). On a 386, you
+ * can't use exception 16 due to bad IBM design, so we have to
+ * rely on the less exact irq13.
+ *
+ * Careful.. Not only is IRQ13 unreliable, but it is also
+ * leads to races. IBM designers who came up with it should
+ * be shot.
+ */
+static irqreturn_t math_error_irq(int cpl, void *dev_id)
+{
+ outb(0, 0xF0);
+ if (ignore_fpu_irq || !boot_cpu_data.hard_math)
+ return IRQ_NONE;
+ math_error((void __user *)get_irq_regs()->ip);
+ return IRQ_HANDLED;
+}
+
+/*
+ * New motherboards sometimes make IRQ 13 be a PCI interrupt,
+ * so allow interrupt sharing.
+ */
+static struct irqaction fpu_irq = {
+ .handler = math_error_irq,
+ .mask = CPU_MASK_NONE,
+ .name = "fpu",
+};
+#endif /* CONFIG_X86_32 */

/*
* ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/