summaryrefslogtreecommitdiff
path: root/lib/libc/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 23:47:39 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 23:47:39 +0000
commit882e83ccf31fca22178b290a6753a605bb52044c (patch)
treee2e6ec6ef7e162fd03a03e5c71bc96ce90d1c105 /lib/libc/arch
parent67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (diff)
sync to netbsd 960418
Diffstat (limited to 'lib/libc/arch')
-rw-r--r--lib/libc/arch/ns32k/gen/Makefile.inc6
-rw-r--r--lib/libc/arch/ns32k/gen/fpgetmask.c21
-rw-r--r--lib/libc/arch/ns32k/gen/fpgetsticky.c27
-rw-r--r--lib/libc/arch/ns32k/gen/fpsetmask.c29
-rw-r--r--lib/libc/arch/ns32k/gen/fpsetsticky.c42
-rw-r--r--lib/libc/arch/ns32k/gen/infinity.c6
6 files changed, 127 insertions, 4 deletions
diff --git a/lib/libc/arch/ns32k/gen/Makefile.inc b/lib/libc/arch/ns32k/gen/Makefile.inc
index ed6ccce6f18..01633096cf5 100644
--- a/lib/libc/arch/ns32k/gen/Makefile.inc
+++ b/lib/libc/arch/ns32k/gen/Makefile.inc
@@ -1,5 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.4 1995/05/03 03:25:11 phil Exp $
+# $OpenBSD: Makefile.inc,v 1.2 1996/04/21 23:38:37 deraadt Exp $
+# $NetBSD: Makefile.inc,v 1.5 1996/04/05 00:23:05 phil Exp $
SRCS+= __main.c _setjmp.S alloca.S fabs.S frexp.S infinity.c isinf.c
SRCS+= ldexp.S modf.S setjmp.S sigsetjmp.S
-SRCS+= flt_rounds.c fpgetround.c fpsetround.c
+SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
+ fpsetround.c fpsetsticky.c
diff --git a/lib/libc/arch/ns32k/gen/fpgetmask.c b/lib/libc/arch/ns32k/gen/fpgetmask.c
new file mode 100644
index 00000000000..64b26fe3977
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fpgetmask.c
@@ -0,0 +1,21 @@
+/* $OpenBSD: fpgetmask.c,v 1.1 1996/04/21 23:38:40 deraadt Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 10, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+#include <machine/cpufunc.h>
+#include <machine/fpu.h>
+
+fp_except
+fpgetmask()
+{
+ fp_except x;
+ fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
+
+ sfsr(x);
+
+ return x & ebits;
+}
diff --git a/lib/libc/arch/ns32k/gen/fpgetsticky.c b/lib/libc/arch/ns32k/gen/fpgetsticky.c
new file mode 100644
index 00000000000..86771541ab6
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fpgetsticky.c
@@ -0,0 +1,27 @@
+/* $OpenBSD: fpgetsticky.c,v 1.1 1996/04/21 23:38:41 deraadt Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 11, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+#include <machine/cpufunc.h>
+#include <machine/fpu.h>
+
+fp_except
+fpgetsticky()
+{
+ fp_except x;
+ fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
+
+ sfsr(x);
+ /* Map FPC_UF to soft underflow enable */
+ if (x & FPC_UF)
+ x |= FPC_UNDE << 1;
+ else
+ x &= ~(FPC_UNDE << 1);
+ x >>= 1;
+
+ return x & ebits;
+}
diff --git a/lib/libc/arch/ns32k/gen/fpsetmask.c b/lib/libc/arch/ns32k/gen/fpsetmask.c
new file mode 100644
index 00000000000..34c4034c10d
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fpsetmask.c
@@ -0,0 +1,29 @@
+/* $OpenBSD: fpsetmask.c,v 1.1 1996/04/21 23:38:44 deraadt Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 10, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+#include <machine/cpufunc.h>
+#include <machine/fpu.h>
+
+fp_except
+fpsetmask(mask)
+ fp_except mask;
+{
+ fp_except old;
+ fp_except new;
+ fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
+
+ sfsr(old);
+
+ new = old;
+ new &= ~ebits;
+ new |= mask & ebits;
+
+ lfsr(new);
+
+ return old & ebits;
+}
diff --git a/lib/libc/arch/ns32k/gen/fpsetsticky.c b/lib/libc/arch/ns32k/gen/fpsetsticky.c
new file mode 100644
index 00000000000..1bfc6ff763b
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fpsetsticky.c
@@ -0,0 +1,42 @@
+/* $OpenBSD: fpsetsticky.c,v 1.1 1996/04/21 23:38:47 deraadt Exp $ */
+
+/*
+ * Written by J.T. Conklin, Apr 10, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+#include <machine/cpufunc.h>
+#include <machine/fpu.h>
+
+fp_except
+fpsetsticky(sticky)
+ fp_except sticky;
+{
+ fp_except old;
+ fp_except new;
+ fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UEN | FPC_UNDE;
+
+ if (sticky & FPC_UNDE) {
+ sticky |= FPC_UEN;
+ sticky &= ~FPC_UNDE;
+ }
+
+ sfsr(old);
+
+ new = old;
+ new &= ebits;
+ new |= (sticky & ebits) << 1;
+
+ lfsr(new);
+
+ /* Map FPC_UF to soft underflow enable */
+ if (old & FPC_UF) {
+ old |= FPC_UNDE << 1;
+ old &= FPC_UF;
+ } else
+ old &= ~(FPC_UNDE << 1);
+ old >>= 1;
+
+ return old & ebits;
+}
diff --git a/lib/libc/arch/ns32k/gen/infinity.c b/lib/libc/arch/ns32k/gen/infinity.c
index 39c4979b3f5..7033c6485f8 100644
--- a/lib/libc/arch/ns32k/gen/infinity.c
+++ b/lib/libc/arch/ns32k/gen/infinity.c
@@ -1,5 +1,7 @@
+/* $OpenBSD: infinity.c,v 1.2 1996/04/21 23:38:49 deraadt Exp $ */
+
#ifndef lint
-static char rcsid[] = "$Id: infinity.c,v 1.1 1995/10/18 08:41:37 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: infinity.c,v 1.2 1996/04/21 23:38:49 deraadt Exp $";
#endif /* not lint */
/* infinity.c */
@@ -7,4 +9,4 @@ static char rcsid[] = "$Id: infinity.c,v 1.1 1995/10/18 08:41:37 deraadt Exp $";
#include <math.h>
/* bytes for +Infinity on a ns32k */
-char __infinity[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f };
+char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };