Date: Tue, 3 Feb 1998 09:19:34 -0800 (PST) From: Thomas Dean <tomdean@ix.netcom.com> To: malte@webmore.com Cc: bartol@salk.edu, questions@FreeBSD.ORG Subject: Re: IEEE Floating Point question: Inf and NaN Message-ID: <199802031719.JAA00500@ix.netcom.com> 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)
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802031719.JAA00500>