From: Alastair B. <lis...@us...> - 2010-05-23 22:50:07
|
Update of /cvsroot/sbcl/sbcl/src/runtime In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv21566/src/runtime Modified Files: ppc-linux-os.c Log Message: 1.0.38.11: Enable floating-point exception delivery on PPC/Linux. * For some reason, Linux disables floating-point exception delivery by default. Use the PR_SET_FPEXC prctl (new in 2.4.21 and 2.5.32) to enable it in "precise" mode (possibly overkill). * This is necessary but not sufficient to fix one of the failing tests in float.pure.lisp. * Given that this is only necessary for one test case, the test suite has woefully incomplete coverage of floating-point exceptions. Index: ppc-linux-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-linux-os.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ppc-linux-os.c 14 Jul 2005 15:41:21 -0000 1.13 +++ ppc-linux-os.c 23 May 2010 22:49:58 -0000 1.14 @@ -34,6 +34,7 @@ #include <sys/time.h> #include <sys/stat.h> #include <unistd.h> +#include <sys/prctl.h> #include "validate.h" #include "ppc-linux-mcontext.h" @@ -41,6 +42,22 @@ size_t os_vm_page_size; int arch_os_thread_init(struct thread *thread) { + /* For some reason, PPC Linux appears to default to not generating + * floating point exceptions. PR_SET_FPEXC is a PPC-specific + * option new in kernel 2.4.21 and 2.5.32 that allows us to + * configure this. Should we need to run on an older kenel, the + * equivalent trick is to get into a signal-handling context and + * modify the saved machine state register. + * + * PR_FP_EXC_PRECISE may be more accurate than we need, + * particularly if we move to the x86oid trick of inserting + * explicit synchronization for floating-point exception + * delivery. If we wish to move to such a model, the other two + * exception delivery modes that we could use are PR_FP_EXC_ASYNC + * and PR_FP_EXC_NONRECOV, and exception delivery can be forced + * by any access to the FPSCR. -- AB, 2010-May-23 */ + prctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE, 0, 0); + return 1; /* success */ } int arch_os_thread_cleanup(struct thread *thread) { |