summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sparc64/gen/Makefile.inc4
-rw-r--r--lib/libc/sparc64/gen/fpsetmask.c27
2 files changed, 29 insertions, 2 deletions
diff --git a/lib/libc/sparc64/gen/Makefile.inc b/lib/libc/sparc64/gen/Makefile.inc
index e4fdbc7..afc3a9e 100644
--- a/lib/libc/sparc64/gen/Makefile.inc
+++ b/lib/libc/sparc64/gen/Makefile.inc
@@ -1,4 +1,4 @@
# $FreeBSD$
-SRCS+= _setjmp.S fixunsdfsi.S flt_rounds.c infinity.c isinf.c ldexp.c \
- modf.S setjmp.S sigsetjmp.S
+SRCS+= _setjmp.S fixunsdfsi.S flt_rounds.c fpsetmask.c infinity.c isinf.c \
+ ldexp.c modf.S setjmp.S sigsetjmp.S
diff --git a/lib/libc/sparc64/gen/fpsetmask.c b/lib/libc/sparc64/gen/fpsetmask.c
new file mode 100644
index 0000000..a1ef3be
--- /dev/null
+++ b/lib/libc/sparc64/gen/fpsetmask.c
@@ -0,0 +1,27 @@
+/*
+ * Written by J.T. Conklin, Apr 10, 1995
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <ieeefp.h>
+
+fp_except_t
+fpsetmask(mask)
+ fp_except_t mask;
+{
+ fp_except_t old;
+ fp_except_t new;
+
+ __asm__("st %%fsr,%0" : "=m" (*&old));
+
+ new = old;
+ new &= ~(0x1f << 23);
+ new |= ((mask & 0x1f) << 23);
+
+ __asm__("ld %0,%%fsr" : : "m" (*&new));
+
+ return (old >> 23) & 0x1f;
+}
OpenPOWER on IntegriCloud