summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/arch/aarch64/gen/fpgetmask.c48
-rw-r--r--lib/libc/arch/aarch64/gen/fpsetmask.c51
-rw-r--r--lib/libm/arch/aarch64/fenv.c24
3 files changed, 30 insertions, 93 deletions
diff --git a/lib/libc/arch/aarch64/gen/fpgetmask.c b/lib/libc/arch/aarch64/gen/fpgetmask.c
index c2158c75963..edbd7a2fdbf 100644
--- a/lib/libc/arch/aarch64/gen/fpgetmask.c
+++ b/lib/libc/arch/aarch64/gen/fpgetmask.c
@@ -1,48 +1,26 @@
-/* $OpenBSD: fpgetmask.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
+/* $OpenBSD: fpgetmask.c,v 1.2 2018/03/16 10:22:52 kettenis Exp $ */
/*
- * Copyright (C) 2014 Andrew Turner
- * All rights reserved.
+ * Copyright (c) 2018 Mark Kettenis <kettenis@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;
}
diff --git a/lib/libc/arch/aarch64/gen/fpsetmask.c b/lib/libc/arch/aarch64/gen/fpsetmask.c
index 997e2da31be..6f397891ec3 100644
--- a/lib/libc/arch/aarch64/gen/fpsetmask.c
+++ b/lib/libc/arch/aarch64/gen/fpsetmask.c
@@ -1,51 +1,26 @@
-/* $OpenBSD: fpsetmask.c,v 1.1 2017/01/11 18:09:24 patrick Exp $ */
+/* $OpenBSD: fpsetmask.c,v 1.2 2018/03/16 10:22:52 kettenis Exp $ */
/*
- * Copyright (C) 2014 Andrew Turner
- * All rights reserved.
+ * Copyright (c) 2018 Mark Kettenis <kettenis@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;
}
diff --git a/lib/libm/arch/aarch64/fenv.c b/lib/libm/arch/aarch64/fenv.c
index 9d2bdaef3fa..88dc3d8ed30 100644
--- a/lib/libm/arch/aarch64/fenv.c
+++ b/lib/libm/arch/aarch64/fenv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fenv.c,v 1.1 2017/01/11 13:38:13 patrick Exp $ */
+/* $OpenBSD: fenv.c,v 1.2 2018/03/16 10:22:52 kettenis Exp $ */
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -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);