Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/arch/x86_64 Fix amd64 feraiseexcept so that it actu...



details:   https://anonhg.NetBSD.org/src/rev/022b882ab3e4
branches:  trunk
changeset: 787002:022b882ab3e4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed May 29 02:27:39 2013 +0000

description:
Fix amd64 feraiseexcept so that it actually traps.

The call to fwait got lost somewhere along the line; the i387 code
has it.

XXX pullup to 6

diffstat:

 lib/libm/arch/x86_64/fenv.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r d9c4faa95c0c -r 022b882ab3e4 lib/libm/arch/x86_64/fenv.c
--- a/lib/libm/arch/x86_64/fenv.c       Wed May 29 00:53:19 2013 +0000
+++ b/lib/libm/arch/x86_64/fenv.c       Wed May 29 02:27:39 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.3 2013/05/29 00:53:19 riastradh Exp $ */
+/* $NetBSD: fenv.c,v 1.4 2013/05/29 02:27:39 riastradh 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.3 2013/05/29 00:53:19 riastradh Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.4 2013/05/29 02:27:39 riastradh 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);



Home | Main Index | Thread Index | Old Index