diff options
| author | forsyth <forsyth@vitanuova.com> | 2010-02-05 15:15:14 +0000 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2010-02-05 15:15:14 +0000 |
| commit | 6bf3ce61406f2f25d9da051cd29cb00fcbe539da (patch) | |
| tree | 7f3707b84995a0bc8ca490d8e342556de843d8b8 | |
| parent | 07f684ffc61236e171b449cfe9f91cef1e62866b (diff) | |
20100205-1515
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | emu/DragonFly/os.c | 5 | ||||
| -rw-r--r-- | emu/FreeBSD/os.c | 14 | ||||
| -rw-r--r-- | emu/Linux/os.c | 7 | ||||
| -rw-r--r-- | emu/OpenBSD/os.c | 13 |
5 files changed, 35 insertions, 5 deletions
@@ -2,6 +2,7 @@ update man pages to replace most references to Styx by 9P update man pages to replace references to sys-dial(2) by dial(2) add DragonFly files (from fgudin and extrudedaluminiu, issue 181); possibly should automatically keep aligned with FreeBSD + fpe handling in OpenBSD and FreeBSD [mechiel, issue 190] 20100203 appl/lib/cfg.b treat \r as white space [issue 69, issue 70] add u64int to lib9.h files that needed it diff --git a/emu/DragonFly/os.c b/emu/DragonFly/os.c index 2284d509..269eed08 100644 --- a/emu/DragonFly/os.c +++ b/emu/DragonFly/os.c @@ -115,9 +115,10 @@ trapSEGV(int signo) static void trapFPE(int signo) { + char buf[64]; USED(signo); - print("FPU status=0x$.4lux", getfsr()); - disfault(nil, "Floating point exception"); + snprint(buf, sizeof(buf), "sys: fp: exception status=%.4lux", getfsr()); + disfault(nil, buf); } static sigset_t initmask; diff --git a/emu/FreeBSD/os.c b/emu/FreeBSD/os.c index 5bf2a833..fd09e968 100644 --- a/emu/FreeBSD/os.c +++ b/emu/FreeBSD/os.c @@ -12,6 +12,7 @@ #include <errno.h> #include <unistd.h> #include <sys/resource.h> +#include <fpuctl.h> enum { @@ -111,6 +112,16 @@ trapSEGV(int signo) disfault(nil, "Segmentation violation"); } +static void +trapFPE(int signo) +{ + + char buf[64]; + USED(signo); + snprint(buf, sizeof(buf), "sys: fp: exception status=%.4lux", getfsr()); + disfault(nil, buf); +} + static sigset_t initmask; static void @@ -156,6 +167,9 @@ setsigs(void) act.sa_handler = trapSEGV; if(sigaction(SIGSEGV, &act, nil)) panic("sigaction SIGSEGV"); + act.sa_handler = trapFPE; + if(sigaction(SIGFPE, &act, nil)) + panic("sigaction SIGFPE"); if(sigaddset(&initmask, SIGINT) == -1) panic("sigaddset"); } diff --git a/emu/Linux/os.c b/emu/Linux/os.c index 3106cb90..86be1389 100644 --- a/emu/Linux/os.c +++ b/emu/Linux/os.c @@ -11,6 +11,7 @@ #include "dat.h" #include "fns.h" #include "error.h" +#include <fpuctl.h> /* glibc 2.3.3-NTPL messes up getpid() by trying to cache the result, so we'll do it ourselves */ #include <sys/syscall.h> @@ -188,13 +189,13 @@ trapSEGV(int signo) disfault(nil, "Segmentation violation"); } -#include <fpuctl.h> static void trapFPE(int signo) { + char buf[64]; USED(signo); - print("FPU status=0x%.4lux", getfsr()); - disfault(nil, "Floating exception"); + snprint(buf, sizeof(buf), "sys: fp: exception status=%.4lux", getfsr()); + disfault(nil, buf); } static void diff --git a/emu/OpenBSD/os.c b/emu/OpenBSD/os.c index 2dd4c4d1..0715ec2a 100644 --- a/emu/OpenBSD/os.c +++ b/emu/OpenBSD/os.c @@ -15,6 +15,7 @@ #include <pwd.h> #include <errno.h> #include <unistd.h> +#include <fpuctl.h> enum { @@ -116,6 +117,15 @@ trapSEGV(int signo) disfault(nil, "Segmentation violation"); } +static void +trapFPE(int signo) +{ + char buf[64]; + USED(signo); + snprint(buf, sizeof(buf), "sys: fp: exception status=%.4lux", getfsr()); + disfault(nil, buf); +} + static sigset_t initmask; static void @@ -161,6 +171,9 @@ setsigs(void) act.sa_handler = trapSEGV; if(sigaction(SIGSEGV, &act, nil)) panic("sigaction SIGSEGV"); + act.sa_handler = trapFPE; + if(sigaction(SIGFPE, &act, nil)) + panic("sigaction SIGFPE"); if(sigaddset(&initmask, SIGINT) == -1) panic("sigaddset"); } |
