Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/arch/arm Fix exception status vs mask confusion, of...



details:   https://anonhg.NetBSD.org/src/rev/206cb6ebb38f
branches:  trunk
changeset: 335197:206cb6ebb38f
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Dec 29 19:11:13 2014 +0000

description:
Fix exception status vs mask confusion, of course feenableexcept(),
fedisableexcept() and fegetexcept() all operate on the mask.

diffstat:

 lib/libm/arch/arm/fenv.c |  24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r cadcbd893069 -r 206cb6ebb38f lib/libm/arch/arm/fenv.c
--- a/lib/libm/arch/arm/fenv.c  Mon Dec 29 19:07:03 2014 +0000
+++ b/lib/libm/arch/arm/fenv.c  Mon Dec 29 19:11:13 2014 +0000
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.5 2014/12/28 10:15:29 martin Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.6 2014/12/29 19:11:13 martin Exp $");
 
 #include <sys/types.h>
 #include <assert.h>
@@ -160,13 +160,13 @@
        _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
-       int old = fpgetsticky();
-       fpsetsticky(old | excepts);
+       int old = fpgetmask();
+       fpsetmask(old | excepts);
        return old;
 #else
        int fpscr = armreg_fpscr_read();
-       armreg_fpscr_write(fpscr | __SHIFTIN((excepts), VFP_FPSCR_CSUM));
-       return __SHIFTOUT(fpscr, VFP_FPSCR_CSUM) & FE_ALL_EXCEPT;
+       armreg_fpscr_write(fpscr | __SHIFTIN((excepts), VFP_FPSCR_ESUM));
+       return __SHIFTOUT(fpscr, VFP_FPSCR_ESUM) & FE_ALL_EXCEPT;
 #endif
 }
 
@@ -177,13 +177,13 @@
        _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
 #ifdef __SOFTFP__
-       int old = fpgetsticky();
-       fpsetsticky(old & ~excepts);
+       int old = fpgetmask();
+       fpsetmask(old & ~excepts);
        return old;
 #else
        int fpscr = armreg_fpscr_read();
-       armreg_fpscr_write(fpscr & ~__SHIFTIN((excepts), VFP_FPSCR_CSUM));
-       return __SHIFTOUT(fpscr, VFP_FPSCR_CSUM) & FE_ALL_EXCEPT;
+       armreg_fpscr_write(fpscr & ~__SHIFTIN((excepts), VFP_FPSCR_ESUM));
+       return __SHIFTOUT(fpscr, VFP_FPSCR_ESUM) & FE_ALL_EXCEPT;
 #endif
 }
 
@@ -206,7 +206,11 @@
 int     
 fegetexcept(void)
 {
-       return fetestexcept(FE_ALL_EXCEPT);
+#ifdef __SOFTFP__
+       return fpgetmask();
+#else
+       return __SHIFTOUT(armreg_fpscr_read(), VFP_FPSCR_ESUM);
+#endif
 }
 
 /*



Home | Main Index | Thread Index | Old Index