Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-0]: src/lib/libm/arch Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/73ad27575e6b
branches:  netbsd-6-0
changeset: 774818:73ad27575e6b
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Jun 14 02:37:53 2013 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #899):
        lib/libm/arch/i387/fenv.c: revision 1.5
        lib/libm/arch/x86_64/fenv.c: revision 1.3-1.4
Fix amd64 feraiseexcept so that it actually traps.
The call to fwait got lost somewhere along the line; the i387 code has it.
Fix sense of fegetexcept on x86.
Somehow I overlooked this when I fixed feenableexcept and fedisableexcept
last summer.

diffstat:

 lib/libm/arch/i387/fenv.c   |   6 +++---
 lib/libm/arch/x86_64/fenv.c |  11 ++++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diffs (70 lines):

diff -r 4df55ffd90bc -r 73ad27575e6b lib/libm/arch/i387/fenv.c
--- a/lib/libm/arch/i387/fenv.c Thu Jun 13 10:55:10 2013 +0000
+++ b/lib/libm/arch/i387/fenv.c Fri Jun 14 02:37:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.3.8.1 2012/08/12 18:53:11 martin Exp $ */
+/* $NetBSD: fenv.c,v 1.3.8.1.4.1 2013/06/14 02:37:53 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004-2005 David Schultz <das%FreeBSD.ORG@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.3.8.1 2012/08/12 18:53:11 martin Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.3.8.1.4.1 2013/06/14 02:37:53 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -510,5 +510,5 @@
         */
        __fnstcw(&control);
 
-       return (control & FE_ALL_EXCEPT);
+       return (~control & FE_ALL_EXCEPT);
 }
diff -r 4df55ffd90bc -r 73ad27575e6b lib/libm/arch/x86_64/fenv.c
--- a/lib/libm/arch/x86_64/fenv.c       Thu Jun 13 10:55:10 2013 +0000
+++ b/lib/libm/arch/x86_64/fenv.c       Fri Jun 14 02:37:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.1.8.1 2012/08/12 18:53:11 martin Exp $ */
+/* $NetBSD: fenv.c,v 1.1.8.1.4.1 2013/06/14 02:37:53 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.1.8.1 2012/08/12 18:53:11 martin Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.1.8.1.4.1 2013/06/14 02:37:53 msaitoh Exp $");
 
 #include <assert.h>
 #include <fenv.h>
@@ -58,6 +58,10 @@
 #define        __fnstenv(__env)        __asm__ __volatile__ \
        ("fnstenv %0" : "=m" (*(__env)))
 
+/* Check for and handle pending unmasked x87 pending FPU exceptions */
+#define        __fwait(__env)          __asm__ __volatile__    \
+       ("fwait")
+
 /* Load the MXCSR register */
 #define        __ldmxcsr(__mxcsr)      __asm__ __volatile__ \
        ("ldmxcsr %0" : : "m" (__mxcsr))
@@ -178,6 +182,7 @@
 
        ex = excepts & FE_ALL_EXCEPT;
        fesetexceptflag((unsigned int *)&excepts, excepts);
+       __fwait();
 
        /* Success */
        return (0);
@@ -519,6 +524,6 @@
         */
        __fnstcw(&control);
 
-       return (control & FE_ALL_EXCEPT);
+       return (~control & FE_ALL_EXCEPT);
 }
 



Home | Main Index | Thread Index | Old Index