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
This commit is contained in:
riastradh 2019-08-25 18:59:52 +00:00
parent f527f35001
commit ab94299db0

View File

@ -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 @@ feraiseexcept(int excepts)
_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;
}