2 * The real floating point exception handler. While it doesn't really
3 * make sense to have this in a module, it makes debugging of this code
4 * in the kernel space a lot easier. So far this handler in the released
5 * kernel source is just a dummy.
7 * Copyright (C) 1997 Ralf Baechle
9 * $Id: fpe.c,v 1.4 1999/05/01 22:40:35 ralf Exp $
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/sched.h>
14 #include <linux/signal.h>
15 #include <linux/smp.h>
16 #include <linux/smp_lock.h>
18 #include <asm/branch.h>
19 #include <asm/ptrace.h>
21 MODULE_AUTHOR("Ralf Baechle <ralf@gnu.org>");
22 MODULE_DESCRIPTION("Experimental floating point exception handler");
23 MODULE_SUPPORTED_DEVICE("MIPS FPU");
25 static void do_fpe(struct pt_regs
*regs
, unsigned int fcr31
)
28 #ifdef CONF_DEBUG_EXCEPTIONS
31 printk("Caught floating exception at epc == %08lx, fcr31 == %08x\n",
32 regs
->cp0_epc
, fcr31
);
33 if (compute_return_epc(regs
))
35 force_sig(SIGFPE
, current
);
41 * For easier experimentation we never increment/decrement
42 * the module usable counter.
44 int register_fpe(void (*handler
)(struct pt_regs
*regs
, unsigned int fcr31
));
45 int unregister_fpe(void (*handler
)(struct pt_regs
*regs
, unsigned int fcr31
));
49 return register_fpe(do_fpe
);
52 void cleanup_module(void)
54 unregister_fpe(do_fpe
);