summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa/npx.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-11-14 14:59:06 +0000
committerbde <bde@FreeBSD.org>1994-11-14 14:59:06 +0000
commitb52c9d7b5ba4ff839adab78feaaa633c6cf09d5d (patch)
treefb79c5beb569b71630b874f1decffea482794049 /sys/amd64/isa/npx.c
parent8332f818bd69473bb342bdbdb95095e8423161c3 (diff)
downloadFreeBSD-src-b52c9d7b5ba4ff839adab78feaaa633c6cf09d5d.zip
FreeBSD-src-b52c9d7b5ba4ff839adab78feaaa633c6cf09d5d.tar.gz
Log processes that exit with an masked npx exception that would trap
with the current default exception (un)mask. There should be no such processes unless you change the mask. Someday the mask should be changed to the IEEE default of everything masked. The npx state gets saved so that it can be checked and this may have the side effect of fixing a bug that was reported for 1.1.5. (npx exceptions may sometimes leak across exits and clobber another process. I can't see how this can happen.) Get some missing/wrong declarations from headers now that the headers have them.
Diffstat (limited to 'sys/amd64/isa/npx.c')
-rw-r--r--sys/amd64/isa/npx.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c
index 35b3af6..0f703fa 100644
--- a/sys/amd64/isa/npx.c
+++ b/sys/amd64/isa/npx.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
- * $Id: npx.c,v 1.15 1994/10/23 21:27:32 wollman Exp $
+ * $Id: npx.c,v 1.16 1994/11/06 00:58:06 bde Exp $
*/
#include "npx.h"
@@ -45,10 +45,13 @@
#include <sys/proc.h>
#include <sys/devconf.h>
#include <sys/ioctl.h>
+#include <sys/syslog.h>
+#include <sys/signalvar.h>
#include <machine/cpu.h>
#include <machine/pcb.h>
#include <machine/trap.h>
+#include <machine/clock.h>
#include <machine/specialreg.h>
#include <i386/isa/icu.h>
@@ -92,8 +95,6 @@ void stop_emulating __P((void));
typedef u_char bool_t;
-extern struct gate_descriptor idt[];
-
static int npxattach __P((struct isa_device *dvp));
static int npxprobe __P((struct isa_device *dvp));
static int npxprobe1 __P((struct isa_device *dvp));
@@ -119,7 +120,7 @@ static volatile u_int npx_traps_while_probing;
* interrupts. We'll still need a special exception 16 handler. The busy
* latch stuff in probintr() can be moved to npxprobe().
*/
-void probeintr(void);
+inthand_t probeintr;
asm
("
.text
@@ -136,7 +137,7 @@ _probeintr:
iret
");
-void probetrap(void);
+inthand_t probetrap;
asm
("
.text
@@ -374,9 +375,21 @@ npxexit(p)
struct proc *p;
{
- if (p == npxproc) {
- start_emulating();
- npxproc = NULL;
+ if (p == npxproc)
+ npxsave(&curpcb->pcb_savefpu);
+ if (npx_exists) {
+ u_int masked_exceptions;
+
+ masked_exceptions = curpcb->pcb_savefpu.sv_env.en_cw
+ & curpcb->pcb_savefpu.sv_env.en_sw & 0x7f;
+ /*
+ * Overflow, divde by 0, and invalid operand would have
+ * caused a trap in 1.1.5.
+ */
+ if (masked_exceptions & 0x0d)
+ log(LOG_ERR,
+ "pid %d (%s) exited with masked floating point exceptions 0x%02x\n",
+ p->p_pid, p->p_comm, masked_exceptions);
}
}
OpenPOWER on IntegriCloud