Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/arch/aarch64 Fix feraiseexcept.



details:   https://anonhg.NetBSD.org/src/rev/8f7c76da646a
branches:  trunk
changeset: 459134:8f7c76da646a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Aug 25 18:59:52 2019 +0000

description:
Fix feraiseexcept.

- Don't touch the trap flags (though on all ARMv8 I know they have no
  effect anyway).

- Don't clear any existing raised exception flags; just add to them.

XXX atf test
XXX pullup-9

diffstat:

 lib/libm/arch/aarch64/fenv.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (32 lines):

diff -r 7f146a430872 -r 8f7c76da646a lib/libm/arch/aarch64/fenv.c
--- a/lib/libm/arch/aarch64/fenv.c      Sun Aug 25 18:31:30 2019 +0000
+++ b/lib/libm/arch/aarch64/fenv.c      Sun Aug 25 18:59:52 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.5 2019/08/25 18:31:30 riastradh Exp $ */
+/* $NetBSD: fenv.c,v 1.6 2019/08/25 18:59:52 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.5 2019/08/25 18:31:30 riastradh Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.6 2019/08/25 18:59:52 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -107,11 +107,9 @@
        _DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
        unsigned int fpsr = reg_fpsr_read();
-       fpsr = (fpsr & ~FPSR_CSUM) | __SHIFTIN(excepts, FPSR_CSUM);
+       excepts &= FE_ALL_EXCEPT; /* paranoia */
+       fpsr |= __SHIFTIN(excepts, FPSR_CSUM);
        reg_fpsr_write(fpsr);
-       unsigned int fpcr = reg_fpcr_read();
-       fpcr = (fpcr & ~FPCR_ESUM) | __SHIFTIN(excepts, FPCR_ESUM);
-       reg_fpcr_write(fpcr);
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index