diff options
author | cracauer <cracauer@FreeBSD.org> | 1999-07-25 13:16:09 +0000 |
---|---|---|
committer | cracauer <cracauer@FreeBSD.org> | 1999-07-25 13:16:09 +0000 |
commit | 36a7b829a04919c4ca14a6e4fe1bf3797c135a82 (patch) | |
tree | 8748ed38e03651976646062add8e82dac5601f42 /sys/amd64/include/trap.h | |
parent | 1c17b991d77a8dc353f1efc23d293b80176cb18b (diff) | |
download | FreeBSD-src-36a7b829a04919c4ca14a6e4fe1bf3797c135a82.zip FreeBSD-src-36a7b829a04919c4ca14a6e4fe1bf3797c135a82.tar.gz |
On FPU exceptions, pass a useful error code (one of the FPE_...
macros) to the signal handler, for old-style BSD signal handlers as
the second (int) argument, for SA_SIGINFO signal handlers as
siginfo_t->si_code. This is source-compatible with Solaris, except
that we have no <siginfo.h> (which isn't even mentioned in POSIX
1003.1b).
An rather complete example program is at
http://www3.cons.org/cracauer/freebsd-signal.c
This will be added to the regression tests in src/.
This commit also adds code to disable the (hardware) FPU from
userconfig, so that you can use a software FP emulator on a machine
that has hardware floating point. See LINT.
Diffstat (limited to 'sys/amd64/include/trap.h')
-rw-r--r-- | sys/amd64/include/trap.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/amd64/include/trap.h b/sys/amd64/include/trap.h index 9d49054..5740379 100644 --- a/sys/amd64/include/trap.h +++ b/sys/amd64/include/trap.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)trap.h 5.4 (Berkeley) 5/9/91 - * $Id$ + * $Id: trap.h,v 1.7 1997/02/22 09:35:19 peter Exp $ */ #ifndef _MACHINE_TRAP_H_ @@ -76,13 +76,29 @@ #define ILL_ALIGN_FAULT T_ALIGNFLT #define ILL_FPOP_FAULT T_FPOPFLT /* coprocessor operand fault */ -/* codes for SIGFPE/ARITHTRAP */ +/* + * codes for SIGFPE/ARITHTRAP + * + */ +/* portable macros */ +#define FPE_INTDIV 1 /* integer divide by zero */ +#define FPE_INTOVF 2 /* integer overflow */ +#define FPE_FLTDIV 3 /* floating point divide by zero */ +#define FPE_FLTOVF 4 /* floating point overflow */ +#define FPE_FLTUND 5 /* floating point underflow */ +#define FPE_FLTRES 6 /* floating point inexact result */ +#define FPE_FLTINV 7 /* invalid floating point operation */ +#define FPE_FLTSUB 8 /* subscript out of range */ + +/* old FreeBSD macros, deprecated */ #define FPE_INTOVF_TRAP 0x1 /* integer overflow */ #define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ #define FPE_FLTDIV_TRAP 0x3 /* floating/decimal divide by zero */ #define FPE_FLTOVF_TRAP 0x4 /* floating overflow */ #define FPE_FLTUND_TRAP 0x5 /* floating underflow */ -#define FPE_FPU_NP_TRAP 0x6 /* floating point unit not present */ +#define FPE_FPU_NP_TRAP 0x6 /* floating point unit not present + * - won't happen in practice + */ #define FPE_SUBRNG_TRAP 0x7 /* subrange out of bounds */ /* codes for SIGBUS */ |