From owner-freebsd-questions Tue Feb 3 09:19:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA28548 for questions-outgoing; Tue, 3 Feb 1998 09:19:49 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from ix.netcom.com (sil-wa5-06.ix.netcom.com [206.214.137.102]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA28537 for ; Tue, 3 Feb 1998 09:19:42 -0800 (PST) (envelope-from tomdean@ix.netcom.com) Received: (from tomdean@localhost) by ix.netcom.com (8.8.8/8.8.8) id JAA00500; Tue, 3 Feb 1998 09:19:34 -0800 (PST) (envelope-from tomdean) Date: Tue, 3 Feb 1998 09:19:34 -0800 (PST) Message-Id: <199802031719.JAA00500@ix.netcom.com> From: Thomas Dean To: malte@webmore.com CC: bartol@salk.edu, questions@FreeBSD.ORG In-reply-to: <3.0.32.19980203083924.02fad158@cyclone.degnet.baynet.de> (message from Malte Lance on Tue, 03 Feb 1998 08:39:25 -0100) Subject: Re: IEEE Floating Point question: Inf and NaN Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe questions" Catching exceptions with a signal handler does not work in FreeBSD. The exception mask is cleared BEFORE the user signal handler is called. In npx.c, ... * * XXX the FP state is not preserved across signal handlers. So signal * handlers cannot afford to do FP unless they preserve the state or * longjmp() out. Both preserving the state and longjmp()ing may be * destroyed by IRQ13 bugs. Clearing FP exceptions is not an acceptable * solution for signals other than SIGFPE. */ void npxintr(unit) int unit; { int code; struct intrframe *frame; if (npxproc == NULL || !npx_exists) { printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n", npxproc, curproc, npx_exists); panic("npxintr from nowhere"); } if (npxproc != curproc) { printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n", npxproc, curproc, npx_exists); panic("npxintr from non-current process"); } outb(0xf0, 0); fnstsw(&curpcb->pcb_savefpu.sv_ex_sw); ===> fnclex(); fnop(); /* * Pass exception to process. */ ... So, for the user process to handle exceptions, you must access curpcb->pcb_savefpu.sv_ex_sw, or modify npx.c to not clear the exception. I do not think this is a problem with 486+ machines. Can this be prevented by using the definition of 'cpu' in the config file? If we have 'cpu "I386_CPU"', then compile the fnclex(), otherwise do not compile fnclex(). #if defined(I386_CPU) fnclex(); #endif