summaryrefslogtreecommitdiffstats
path: root/lib/libc/mips/gen/fpsetmask.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-03-03 07:06:17 +0000
committerimp <imp@FreeBSD.org>1999-03-03 07:06:17 +0000
commit4d23a3a1e4929fb9ae50da0a0cc6224e36682889 (patch)
tree6319ff0addf11af182760607660afd2709373b75 /lib/libc/mips/gen/fpsetmask.c
parentcaaaa6363b062987768a65519c536c68acb1a3c7 (diff)
downloadFreeBSD-src-4d23a3a1e4929fb9ae50da0a0cc6224e36682889.zip
FreeBSD-src-4d23a3a1e4929fb9ae50da0a0cc6224e36682889.tar.gz
Bring in initial libc support for mips. These files were taken from
the OpenBSD tree and should be considered preliminary. They are here to facilitate building of the tree.
Diffstat (limited to 'lib/libc/mips/gen/fpsetmask.c')
-rw-r--r--lib/libc/mips/gen/fpsetmask.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/libc/mips/gen/fpsetmask.c b/lib/libc/mips/gen/fpsetmask.c
new file mode 100644
index 0000000..c57f52f
--- /dev/null
+++ b/lib/libc/mips/gen/fpsetmask.c
@@ -0,0 +1,28 @@
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD$";
+#endif /* LIBC_SCCS and not lint */
+
+#include <ieeefp.h>
+
+fp_except
+fpsetmask(mask)
+ fp_except mask;
+{
+ fp_except old;
+ fp_except new;
+
+ __asm__("cfc1 %0,$31" : "=r" (old));
+
+ new = old;
+ new &= ~(0x1f << 7);
+ new |= ((mask & 0x1f) << 7);
+
+ __asm__("ctc1 %0,$31" : : "r" (new));
+
+ return (old >> 7) & 0x1f;
+}
OpenPOWER on IntegriCloud