[parisc-linux] subo -> overflow_trap (12) -> What to do?
Carlos O'Donell
carlos@baldric.uwo.ca
Sat, 17 Aug 2002 18:05:45 -0400
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
pa,
Talking with Christophe Rhodes who is porting some Common Lisp code[1]
to parisc-linux and he has some old-ish code from HPUX (circa 1994)
that does some interesting things :)
The code does a 'subo' and it _does_ cause an overflow_trap (12) which is
currently unhandled in our traps.c ... this trickles into a SIGBUS, which
is questionable (as the comment notes).
In HPUX the code sets si_code to FPE_INTOVF as well as sending a SIGFPE
to the offending application. From there the handler does all the 'bignum'
cleanup and Lisp land is all happy.
So I've gone ahead and implemented this functionality into traps.c, but
I'm not sure if this is the right way to go. What do people think?
If any HPUX people would like to chime in? :)
Patch attached.
c.
[1] Package is 'sbcl'
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kernel-parisc-trap.c.diff"
--- linux/arch/parisc/kernel/traps.c.orig 2002-08-17 17:37:26.000000000 -0400
+++ linux/arch/parisc/kernel/traps.c 2002-08-17 17:58:39.000000000 -0400
@@ -561,6 +561,14 @@
force_sig_info(SIGILL, &si, current);
return;
+ case 12:
+ /* Overflow Trap, let the userland signal handler do the cleanup */
+ si.si_signo = SIGFPE;
+ si.si_code = FPE_INTOVF;
+ si.si_addr = (void *) regs->iaoq[0];
+ force_sig_info(SIGFPE, &si, current);
+ return;
+
case 14:
/* Assist Exception Trap, i.e. floating point exception. */
die_if_kernel("Floating point exception", regs, 0); /* quiet */
--pWyiEgJYm5f9v55/--