Like armv7, the hardware we run on doesn't actually support trapping
floating-point exceptions.  So disable that functionality explicitly.

ok?


Index: libm/arch/aarch64/fenv.c
===================================================================
RCS file: /cvs/src/lib/libm/arch/aarch64/fenv.c,v
retrieving revision 1.1
diff -u -p -r1.1 fenv.c
--- libm/arch/aarch64/fenv.c    11 Jan 2017 13:38:13 -0000      1.1
+++ libm/arch/aarch64/fenv.c    11 Mar 2018 20:02:20 -0000
@@ -252,33 +252,17 @@ DEF_STD(feupdateenv);
 int
 feenableexcept(int mask)
 {
-       fenv_t old_r, new_r;
-
-       __mrs_fpcr(old_r);
-       new_r = old_r | ((mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
-       __msr_fpcr(new_r);
-       return ((old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+       return -1;
 }
-DEF_STD(feenableexcept);
 
 int
 fedisableexcept(int mask)
 {
-       fenv_t old_r, new_r;
-
-       __mrs_fpcr(old_r);
-       new_r = old_r & ~((mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
-       __msr_fpcr(new_r);
-       return ((old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+       return 0;
 }
-DEF_STD(fedisableexcept);
 
 int
 fegetexcept(void)
 {
-       fenv_t r;
-
-       __mrs_fpcr(r);
-       return ((r & _ENABLE_MASK) >> _FPUSW_SHIFT);
+       return 0;
 }
-DEF_STD(fegetexcept);
Index: libc/arch/aarch64/gen/fpgetmask.c
===================================================================
RCS file: /cvs/src/lib/libc/arch/aarch64/gen/fpgetmask.c,v
retrieving revision 1.1
diff -u -p -r1.1 fpgetmask.c
--- libc/arch/aarch64/gen/fpgetmask.c   11 Jan 2017 18:09:24 -0000      1.1
+++ libc/arch/aarch64/gen/fpgetmask.c   11 Mar 2018 20:02:20 -0000
@@ -1,48 +1,26 @@
-/*     $OpenBSD: fpgetmask.c,v 1.1 2017/01/11 18:09:24 patrick Exp $   */
+/*     $OpenBSD: fpgetmask.c,v 1.1 2018/02/28 11:16:54 kettenis Exp $  */
 /*
- * Copyright (C) 2014 Andrew Turner
- * All rights reserved.
+ * Copyright (c) 2018 Mark Kettenis <kette...@openbsd.org>
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
  *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <sys/cdefs.h>
-
-#include <sys/types.h>
 #include <ieeefp.h>
 
-#ifdef __weak_alias
 __weak_alias(_fpgetmask,fpgetmask);
-#endif
-
-#define FP_X_MASK      (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
 
 fp_except
 fpgetmask(void)
 {
-       fp_except mask;
-
-       __asm __volatile("mrs %x0, fpcr" : "=&r"(mask));
-
-       return ((mask >> 8) & FP_X_MASK);
+       return 0;
 }
Index: libc/arch/aarch64/gen/fpsetmask.c
===================================================================
RCS file: /cvs/src/lib/libc/arch/aarch64/gen/fpsetmask.c,v
retrieving revision 1.1
diff -u -p -r1.1 fpsetmask.c
--- libc/arch/aarch64/gen/fpsetmask.c   11 Jan 2017 18:09:24 -0000      1.1
+++ libc/arch/aarch64/gen/fpsetmask.c   11 Mar 2018 20:02:20 -0000
@@ -1,51 +1,26 @@
-/*     $OpenBSD: fpsetmask.c,v 1.1 2017/01/11 18:09:24 patrick Exp $   */
+/*     $OpenBSD: fpsetmask.c,v 1.1 2018/02/28 11:16:54 kettenis Exp $  */
 /*
- * Copyright (C) 2014 Andrew Turner
- * All rights reserved.
+ * Copyright (c) 2018 Mark Kettenis <kette...@openbsd.org>
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
  *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <sys/cdefs.h>
-
-#include <sys/types.h>
 #include <ieeefp.h>
 
-#ifdef __weak_alias
 __weak_alias(_fpsetmask,fpsetmask);
-#endif
-
-#define FP_X_MASK      (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
 
 fp_except
 fpsetmask(fp_except mask)
 {
-       fp_except old, new;
-
-       __asm __volatile("mrs %x0, fpcr" : "=&r"(old));
-       mask = (mask & FP_X_MASK) << 8;
-       new = (old & ~(FP_X_MASK << 8)) | mask;
-       __asm __volatile("msr fpcr, %x0" : : "r"(new));
-
-       return ((old >> 8) & FP_X_MASK);
+       return 0;
 }

Reply via email to