summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2015-12-21 17:02:32 +0000
committerchristos <christos@NetBSD.org>2015-12-21 17:02:32 +0000
commitf5ffb46a6be16144acf4e489b0df2698d80fd9d9 (patch)
treecde969f855f4eace0bc64c79675f0773abc40b67 /sys
parent82454b65d2fd24ff99102798d66d6b3ed0097d0b (diff)
Add mips fenv.h (From FreeBSD)
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/algor/include/Makefile4
-rw-r--r--sys/arch/algor/include/fenv.h3
-rw-r--r--sys/arch/amigappc/include/Makefile3
-rw-r--r--sys/arch/arc/include/Makefile4
-rw-r--r--sys/arch/arc/include/fenv.h3
-rw-r--r--sys/arch/bebox/include/Makefile3
-rw-r--r--sys/arch/cobalt/include/Makefile4
-rw-r--r--sys/arch/cobalt/include/fenv.h3
-rw-r--r--sys/arch/emips/include/Makefile4
-rw-r--r--sys/arch/emips/include/fenv.h3
-rw-r--r--sys/arch/evbmips/include/Makefile4
-rw-r--r--sys/arch/evbmips/include/fenv.h3
-rw-r--r--sys/arch/evbppc/include/Makefile3
-rw-r--r--sys/arch/ews4800mips/include/Makefile4
-rw-r--r--sys/arch/ews4800mips/include/fenv.h3
-rw-r--r--sys/arch/hpcmips/include/Makefile4
-rw-r--r--sys/arch/hpcmips/include/fenv.h3
-rw-r--r--sys/arch/ibmnws/include/Makefile3
-rw-r--r--sys/arch/macppc/include/Makefile3
-rw-r--r--sys/arch/mips/include/Makefile4
-rw-r--r--sys/arch/mips/include/fenv.h225
-rw-r--r--sys/arch/mipsco/include/Makefile4
-rw-r--r--sys/arch/mipsco/include/fenv.h3
-rw-r--r--sys/arch/mvmeppc/include/Makefile3
-rw-r--r--sys/arch/newsmips/include/Makefile4
-rw-r--r--sys/arch/newsmips/include/fenv.h3
-rw-r--r--sys/arch/ofppc/include/Makefile3
-rw-r--r--sys/arch/playstation2/include/Makefile4
-rw-r--r--sys/arch/playstation2/include/fenv.h3
-rw-r--r--sys/arch/pmax/include/Makefile4
-rw-r--r--sys/arch/pmax/include/fenv.h3
-rw-r--r--sys/arch/powerpc/include/Makefile4
-rw-r--r--sys/arch/prep/include/Makefile3
-rw-r--r--sys/arch/rs6000/include/Makefile3
-rw-r--r--sys/arch/sandpoint/include/Makefile3
-rw-r--r--sys/arch/sbmips/include/Makefile4
-rw-r--r--sys/arch/sbmips/include/fenv.h3
-rw-r--r--sys/arch/sgimips/include/Makefile4
-rw-r--r--sys/arch/sgimips/include/fenv.h3
39 files changed, 314 insertions, 40 deletions
diff --git a/sys/arch/algor/include/Makefile b/sys/arch/algor/include/Makefile
index 4ecb96926c4..67099249a3b 100644
--- a/sys/arch/algor/include/Makefile
+++ b/sys/arch/algor/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 2011/07/17 20:54:35 joerg Exp $
+# $NetBSD: Makefile,v 1.15 2015/12/21 17:02:32 christos Exp $
INCSDIR=/usr/include/algor
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/algor/include/fenv.h b/sys/arch/algor/include/fenv.h
new file mode 100644
index 00000000000..3542978a678
--- /dev/null
+++ b/sys/arch/algor/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:32 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/amigappc/include/Makefile b/sys/arch/amigappc/include/Makefile
index 5a1764817e4..90222641339 100644
--- a/sys/arch/amigappc/include/Makefile
+++ b/sys/arch/amigappc/include/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.25 2014/07/23 18:19:43 alnsn Exp $
+# $NetBSD: Makefile,v 1.26 2015/12/21 17:02:32 christos Exp $
INCSDIR= /usr/include/amigappc
INCS= disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/arc/include/Makefile b/sys/arch/arc/include/Makefile
index 310d1ee67db..4e250f9b510 100644
--- a/sys/arch/arc/include/Makefile
+++ b/sys/arch/arc/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.31 2011/07/17 20:54:37 joerg Exp $
+# $NetBSD: Makefile,v 1.32 2015/12/21 17:02:32 christos Exp $
INCSDIR= /usr/include/arc
@@ -9,7 +9,7 @@ INCS= ansi.h asm.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
kcore.h kdbparam.h \
diff --git a/sys/arch/arc/include/fenv.h b/sys/arch/arc/include/fenv.h
new file mode 100644
index 00000000000..3542978a678
--- /dev/null
+++ b/sys/arch/arc/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:32 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/bebox/include/Makefile b/sys/arch/bebox/include/Makefile
index d9e85cb3126..5d13cca3c29 100644
--- a/sys/arch/bebox/include/Makefile
+++ b/sys/arch/bebox/include/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.25 2014/07/23 18:19:43 alnsn Exp $
+# $NetBSD: Makefile,v 1.26 2015/12/21 17:02:32 christos Exp $
INCSDIR= /usr/include/bebox
INCS= bootinfo.h \
disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
spkr.h \
diff --git a/sys/arch/cobalt/include/Makefile b/sys/arch/cobalt/include/Makefile
index 4f635f44f05..b614735c1e4 100644
--- a/sys/arch/cobalt/include/Makefile
+++ b/sys/arch/cobalt/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2014/07/23 18:19:43 alnsn Exp $
+# $NetBSD: Makefile,v 1.23 2015/12/21 17:02:32 christos Exp $
INCSDIR= /usr/include/cobalt
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/cobalt/include/fenv.h b/sys/arch/cobalt/include/fenv.h
new file mode 100644
index 00000000000..3542978a678
--- /dev/null
+++ b/sys/arch/cobalt/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:32 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/emips/include/Makefile b/sys/arch/emips/include/Makefile
index 3c25eb778f9..0f6b2dbc68b 100644
--- a/sys/arch/emips/include/Makefile
+++ b/sys/arch/emips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2014/07/19 14:35:10 alnsn Exp $
+# $NetBSD: Makefile,v 1.5 2015/12/21 17:02:32 christos Exp $
INCSDIR= /usr/include/emips
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h emipsreg.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/emips/include/fenv.h b/sys/arch/emips/include/fenv.h
new file mode 100644
index 00000000000..3542978a678
--- /dev/null
+++ b/sys/arch/emips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:32 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/evbmips/include/Makefile b/sys/arch/evbmips/include/Makefile
index 1153bc6c14f..e17de0987ce 100644
--- a/sys/arch/evbmips/include/Makefile
+++ b/sys/arch/evbmips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2014/07/23 18:19:43 alnsn Exp $
+# $NetBSD: Makefile,v 1.17 2015/12/21 17:02:33 christos Exp $
INCSDIR=/usr/include/evbmips
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
kcore.h kdbparam.h \
diff --git a/sys/arch/evbmips/include/fenv.h b/sys/arch/evbmips/include/fenv.h
new file mode 100644
index 00000000000..ad65382157c
--- /dev/null
+++ b/sys/arch/evbmips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:33 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/evbppc/include/Makefile b/sys/arch/evbppc/include/Makefile
index 82b3dc956ce..96946c145ca 100644
--- a/sys/arch/evbppc/include/Makefile
+++ b/sys/arch/evbppc/include/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.7 2014/07/23 18:19:43 alnsn Exp $
+# $NetBSD: Makefile,v 1.8 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/evbppc
INCS= disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/ews4800mips/include/Makefile b/sys/arch/ews4800mips/include/Makefile
index 562d70ab547..b9c900c99b1 100644
--- a/sys/arch/ews4800mips/include/Makefile
+++ b/sys/arch/ews4800mips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2014/07/23 18:19:43 alnsn Exp $
+# $NetBSD: Makefile,v 1.8 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/ews4800mips
@@ -7,7 +7,7 @@ INCS= ansi.h aout_machdep.h asm.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
kcore.h kdbparam.h \
diff --git a/sys/arch/ews4800mips/include/fenv.h b/sys/arch/ews4800mips/include/fenv.h
new file mode 100644
index 00000000000..ad65382157c
--- /dev/null
+++ b/sys/arch/ews4800mips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:33 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/hpcmips/include/Makefile b/sys/arch/hpcmips/include/Makefile
index 8291be79818..bb1adcfbf43 100644
--- a/sys/arch/hpcmips/include/Makefile
+++ b/sys/arch/hpcmips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.25 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/hpcmips
@@ -7,7 +7,7 @@ INCS= ansi.h apmvar.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/hpcmips/include/fenv.h b/sys/arch/hpcmips/include/fenv.h
new file mode 100644
index 00000000000..ad65382157c
--- /dev/null
+++ b/sys/arch/hpcmips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:33 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/ibmnws/include/Makefile b/sys/arch/ibmnws/include/Makefile
index 71a4fe14dff..506862ed359 100644
--- a/sys/arch/ibmnws/include/Makefile
+++ b/sys/arch/ibmnws/include/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.6 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.7 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/ibmnws
INCS= disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/macppc/include/Makefile b/sys/arch/macppc/include/Makefile
index afdf62277c4..5c83f312c85 100644
--- a/sys/arch/macppc/include/Makefile
+++ b/sys/arch/macppc/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.22 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/macppc
@@ -7,6 +7,7 @@ INCSDIR= /usr/include/macppc
INCS= adbsys.h apmvar.h autoconf.h \
disklabel.h \
grfioctl.h \
+ fenv.h \
intr.h \
keyboard.h \
sljit_machdep.h \
diff --git a/sys/arch/mips/include/Makefile b/sys/arch/mips/include/Makefile
index b49d3f6559d..e19f872deeb 100644
--- a/sys/arch/mips/include/Makefile
+++ b/sys/arch/mips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.32 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.33 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/mips
@@ -6,7 +6,7 @@ INCS= ansi.h asm.h \
bswap.h \
cachectl.h cdefs.h cpu.h cpuregs.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
kcore.h kdbparam.h \
diff --git a/sys/arch/mips/include/fenv.h b/sys/arch/mips/include/fenv.h
new file mode 100644
index 00000000000..f7f0d2e8b86
--- /dev/null
+++ b/sys/arch/mips/include/fenv.h
@@ -0,0 +1,225 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:33 christos Exp $ */
+
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * $FreeBSD: head/lib/msun/mips/fenv.h 226218 2011-10-10 15:43:09Z das $
+ */
+
+#ifndef _MIPS_FENV_H_
+#define _MIPS_FENV_H_
+
+#include <sys/stdint.h>
+
+#ifndef __fenv_static
+#define __fenv_static static
+#endif
+
+typedef uint32_t fenv_t;
+typedef uint32_t fexcept_t;
+
+/* Exception flags */
+#define FE_INVALID 0x0001
+#define FE_DIVBYZERO 0x0002
+#define FE_OVERFLOW 0x0004
+#define FE_UNDERFLOW 0x0008
+#define FE_INEXACT 0x0010
+#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
+ FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+/* Rounding modes */
+#define FE_TONEAREST 0x0000
+#define FE_TOWARDZERO 0x0001
+#define FE_UPWARD 0x0002
+#define FE_DOWNWARD 0x0003
+#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
+ FE_UPWARD | FE_TOWARDZERO)
+__BEGIN_DECLS
+
+/* Default floating-point environment */
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV (&__fe_dfl_env)
+
+/* We need to be able to map status flag positions to mask flag positions */
+#define _FPUSW_SHIFT 16
+#define _ENABLE_MASK (FE_ALL_EXCEPT << _FPUSW_SHIFT)
+
+#ifdef ARM_HARD_FLOAT
+#define __rfs(__fpsr) __asm __volatile("rfs %0" : "=r" (*(__fpsr)))
+#define __wfs(__fpsr) __asm __volatile("wfs %0" : : "r" (__fpsr))
+#else
+#define __rfs(__fpsr)
+#define __wfs(__fpsr)
+#endif
+
+__fenv_static inline int
+feclearexcept(int __excepts)
+{
+ fexcept_t __fpsr;
+
+ __rfs(&__fpsr);
+ __fpsr &= ~__excepts;
+ __wfs(__fpsr);
+ return (0);
+}
+
+__fenv_static inline int
+fegetexceptflag(fexcept_t *__flagp, int __excepts)
+{
+ fexcept_t __fpsr;
+
+ __rfs(&__fpsr);
+ *__flagp = __fpsr & __excepts;
+ return (0);
+}
+
+__fenv_static inline int
+fesetexceptflag(const fexcept_t *__flagp, int __excepts)
+{
+ fexcept_t __fpsr;
+
+ __rfs(&__fpsr);
+ __fpsr &= ~__excepts;
+ __fpsr |= *__flagp & __excepts;
+ __wfs(__fpsr);
+ return (0);
+}
+
+__fenv_static inline int
+feraiseexcept(int __excepts)
+{
+ fexcept_t __ex = __excepts;
+
+ fesetexceptflag(&__ex, __excepts); /* XXX */
+ return (0);
+}
+
+__fenv_static inline int
+fetestexcept(int __excepts)
+{
+ fexcept_t __fpsr;
+
+ __rfs(&__fpsr);
+ return (__fpsr & __excepts);
+}
+
+__fenv_static inline int
+fegetround(void)
+{
+
+ /*
+ * Apparently, the rounding mode is specified as part of the
+ * instruction format on ARM, so the dynamic rounding mode is
+ * indeterminate. Some FPUs may differ.
+ */
+ return (-1);
+}
+
+__fenv_static inline int
+fesetround(int __round)
+{
+
+ return (-1);
+}
+
+__fenv_static inline int
+fegetenv(fenv_t *__envp)
+{
+
+ __rfs(__envp);
+ return (0);
+}
+
+__fenv_static inline int
+feholdexcept(fenv_t *__envp)
+{
+ fenv_t __env;
+
+ __rfs(&__env);
+ *__envp = __env;
+ __env &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
+ __wfs(__env);
+ return (0);
+}
+
+__fenv_static inline int
+fesetenv(const fenv_t *__envp)
+{
+
+ __wfs(*__envp);
+ return (0);
+}
+
+__fenv_static inline int
+feupdateenv(const fenv_t *__envp)
+{
+ fexcept_t __fpsr;
+
+ __rfs(&__fpsr);
+ __wfs(*__envp);
+ feraiseexcept(__fpsr & FE_ALL_EXCEPT);
+ return (0);
+}
+
+#if defined(_NETBSD_SOURCE) || defined(_GNU_SOURCE)
+
+/* We currently provide no external definitions of the functions below. */
+
+static inline int
+feenableexcept(int __mask)
+{
+ fenv_t __old_fpsr, __new_fpsr;
+
+ __rfs(&__old_fpsr);
+ __new_fpsr = __old_fpsr | (__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT;
+ __wfs(__new_fpsr);
+ return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static inline int
+fedisableexcept(int __mask)
+{
+ fenv_t __old_fpsr, __new_fpsr;
+
+ __rfs(&__old_fpsr);
+ __new_fpsr = __old_fpsr & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
+ __wfs(__new_fpsr);
+ return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static inline int
+fegetexcept(void)
+{
+ fenv_t __fpsr;
+
+ __rfs(&__fpsr);
+ return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
+}
+
+#endif /* _NETBSD_SOURCE || _GNU_SOURCE */
+
+__END_DECLS
+
+#endif /* !_FENV_H_ */
diff --git a/sys/arch/mipsco/include/Makefile b/sys/arch/mipsco/include/Makefile
index 829b24839b5..9f2a762ccac 100644
--- a/sys/arch/mipsco/include/Makefile
+++ b/sys/arch/mipsco/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2014/07/19 14:35:10 alnsn Exp $
+# $NetBSD: Makefile,v 1.23 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/mipsco
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/mipsco/include/fenv.h b/sys/arch/mipsco/include/fenv.h
new file mode 100644
index 00000000000..ad65382157c
--- /dev/null
+++ b/sys/arch/mipsco/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:33 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/mvmeppc/include/Makefile b/sys/arch/mvmeppc/include/Makefile
index 2c8060daf7f..44241da7770 100644
--- a/sys/arch/mvmeppc/include/Makefile
+++ b/sys/arch/mvmeppc/include/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.9 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.10 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/mvmeppc
INCS= bootinfo.h \
disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/newsmips/include/Makefile b/sys/arch/newsmips/include/Makefile
index bf53e8af41e..33e46cd57aa 100644
--- a/sys/arch/newsmips/include/Makefile
+++ b/sys/arch/newsmips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.36 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.37 2015/12/21 17:02:33 christos Exp $
INCSDIR= /usr/include/newsmips
@@ -7,7 +7,7 @@ INCS= adrsmap.h ansi.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/newsmips/include/fenv.h b/sys/arch/newsmips/include/fenv.h
new file mode 100644
index 00000000000..ad65382157c
--- /dev/null
+++ b/sys/arch/newsmips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:33 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/ofppc/include/Makefile b/sys/arch/ofppc/include/Makefile
index 7b72ba51d57..cbaf81a2222 100644
--- a/sys/arch/ofppc/include/Makefile
+++ b/sys/arch/ofppc/include/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.21 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.22 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/ofppc
INCS= disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/playstation2/include/Makefile b/sys/arch/playstation2/include/Makefile
index f63a1cd95da..1cc91e59bce 100644
--- a/sys/arch/playstation2/include/Makefile
+++ b/sys/arch/playstation2/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2014/03/31 11:25:49 martin Exp $
+# $NetBSD: Makefile,v 1.12 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/playstation2
@@ -7,7 +7,7 @@ INCS= ansi.h aout_machdep.h asm.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/playstation2/include/fenv.h b/sys/arch/playstation2/include/fenv.h
new file mode 100644
index 00000000000..e5b8e6eca73
--- /dev/null
+++ b/sys/arch/playstation2/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:34 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/pmax/include/Makefile b/sys/arch/pmax/include/Makefile
index 0de6c222130..e06c5bb40de 100644
--- a/sys/arch/pmax/include/Makefile
+++ b/sys/arch/pmax/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2014/07/23 18:19:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.38 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/pmax
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/pmax/include/fenv.h b/sys/arch/pmax/include/fenv.h
new file mode 100644
index 00000000000..e5b8e6eca73
--- /dev/null
+++ b/sys/arch/pmax/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:34 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/powerpc/include/Makefile b/sys/arch/powerpc/include/Makefile
index 5479774befa..8985ac308b5 100644
--- a/sys/arch/powerpc/include/Makefile
+++ b/sys/arch/powerpc/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.40 2014/07/23 18:19:45 alnsn Exp $
+# $NetBSD: Makefile,v 1.41 2015/12/21 17:02:34 christos Exp $
.if !defined(INCSDIR)
INCSDIR?= /usr/include/powerpc
@@ -9,7 +9,7 @@ INCS+= ansi.h aout_machdep.h asm.h \
bswap.h \
cdefs.h cpu.h \
elf_machdep.h endian.h endian_machdep.h \
- float.h fpu.h frame.h \
+ fenv.h float.h fpu.h frame.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
kcore.h \
diff --git a/sys/arch/prep/include/Makefile b/sys/arch/prep/include/Makefile
index 97c67b539df..508bb885855 100644
--- a/sys/arch/prep/include/Makefile
+++ b/sys/arch/prep/include/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.21 2014/07/23 18:19:45 alnsn Exp $
+# $NetBSD: Makefile,v 1.22 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/prep
INCS= bootinfo.h \
disklabel.h \
+ fenv.h \
intr.h \
nvram.h \
sljit_machdep.h \
diff --git a/sys/arch/rs6000/include/Makefile b/sys/arch/rs6000/include/Makefile
index cac15aa7e49..940acd14573 100644
--- a/sys/arch/rs6000/include/Makefile
+++ b/sys/arch/rs6000/include/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.3 2014/07/23 18:19:45 alnsn Exp $
+# $NetBSD: Makefile,v 1.4 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/rs6000
INCS= bootinfo.h \
disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/sandpoint/include/Makefile b/sys/arch/sandpoint/include/Makefile
index af1e8e6da38..ba8bd41b35b 100644
--- a/sys/arch/sandpoint/include/Makefile
+++ b/sys/arch/sandpoint/include/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.19 2014/07/23 18:19:45 alnsn Exp $
+# $NetBSD: Makefile,v 1.20 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/sandpoint
INCS= bootinfo.h \
disklabel.h \
+ fenv.h \
intr.h \
sljit_machdep.h \
vmparam.h
diff --git a/sys/arch/sbmips/include/Makefile b/sys/arch/sbmips/include/Makefile
index 6c3e79553c7..16f2523fc0e 100644
--- a/sys/arch/sbmips/include/Makefile
+++ b/sys/arch/sbmips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2014/07/23 18:19:45 alnsn Exp $
+# $NetBSD: Makefile,v 1.16 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/sbmips
@@ -10,7 +10,7 @@ INCS= ansi.h asm.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
kcore.h kdbparam.h \
diff --git a/sys/arch/sbmips/include/fenv.h b/sys/arch/sbmips/include/fenv.h
new file mode 100644
index 00000000000..e5b8e6eca73
--- /dev/null
+++ b/sys/arch/sbmips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:34 christos Exp $ */
+
+#include <mips/fenv.h>
diff --git a/sys/arch/sgimips/include/Makefile b/sys/arch/sgimips/include/Makefile
index 1847f645340..1ce30672546 100644
--- a/sys/arch/sgimips/include/Makefile
+++ b/sys/arch/sgimips/include/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.23 2014/07/23 18:19:45 alnsn Exp $
+# $NetBSD: Makefile,v 1.24 2015/12/21 17:02:34 christos Exp $
INCSDIR= /usr/include/sgimips
@@ -7,7 +7,7 @@ INCS= asm.h ansi.h autoconf.h \
cdefs.h cpu.h \
disklabel.h \
ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
- float.h \
+ fenv.h float.h \
ieee.h ieeefp.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
intr.h \
diff --git a/sys/arch/sgimips/include/fenv.h b/sys/arch/sgimips/include/fenv.h
new file mode 100644
index 00000000000..e5b8e6eca73
--- /dev/null
+++ b/sys/arch/sgimips/include/fenv.h
@@ -0,0 +1,3 @@
+/* $NetBSD: fenv.h,v 1.1 2015/12/21 17:02:34 christos Exp $ */
+
+#include <mips/fenv.h>