summaryrefslogtreecommitdiff
path: root/lib/libarch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-09-24 13:54:07 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-09-24 13:54:07 +0000
commitb0afb2a37a97f867b914595794440393a757146a (patch)
treeb9fe39ce15ed0776c5dbcbf9a67082f2a73a3e95 /lib/libarch
parent79c56e9bfd790f055790d989e5f1bbfb652f1ca2 (diff)
Provide IRIX-compatible get_fpc_csr() and set_fpc_csr() for mips, although
we don't provide the silly union to decompose the value. This will allow userland to flip the ``flush denormalized to zero'' setting, which apparently is being relied upon by tcl. Asked by jasper@ a long time ago. Riding upon the upcoming libc major crank.
Diffstat (limited to 'lib/libarch')
-rw-r--r--lib/libarch/mips64/Makefile5
-rw-r--r--lib/libarch/mips64/get_fpc_csr.368
2 files changed, 71 insertions, 2 deletions
diff --git a/lib/libarch/mips64/Makefile b/lib/libarch/mips64/Makefile
index b9667366d73..027fb68abfa 100644
--- a/lib/libarch/mips64/Makefile
+++ b/lib/libarch/mips64/Makefile
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile,v 1.2 2010/02/03 20:49:00 miod Exp $
+# $OpenBSD: Makefile,v 1.3 2010/09/24 13:54:05 miod Exp $
-MAN= cacheflush.3
+MAN= cacheflush.3 get_fpc_csr.3
+MLINKS= get_fpc_csr.3 set_fpc_csr.3
MANSUBDIR= loongson sgi
#.if ${MACHINE_CPU} == "mips64"
diff --git a/lib/libarch/mips64/get_fpc_csr.3 b/lib/libarch/mips64/get_fpc_csr.3
new file mode 100644
index 00000000000..f3f7631ad33
--- /dev/null
+++ b/lib/libarch/mips64/get_fpc_csr.3
@@ -0,0 +1,68 @@
+.\" $OpenBSD: get_fpc_csr.3,v 1.1 2010/09/24 13:54:05 miod Exp $
+.\"
+.\" Copyright (c) 2010 Miodrag Vallat.
+.\"
+.\" 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.
+.\"
+.Dd $Mdocdate: September 24 2010 $
+.Dt GET_FPC_CSR 3
+.Os
+.Sh NAME
+.Nm get_fpc_csr ,
+.Nm set_fpc_csr
+.Nd Floating-point control register access
+.Sh SYNOPSIS
+.In machine/fpu.h
+.Ft int
+.Fn get_fpc_csr
+.Ft int
+.Fn set_fpc_csr "int csr"
+.Sh DESCRIPTION
+The
+.Fn get_fpc_csr
+function returns the curent value of the floating-point control register.
+The
+.Fn set_fpc_csr
+function replaces the value of the floating-point control register with
+.Fa csr
+and returns the previous value.
+.Pp
+These functions are provided for
+.Tn IRIX
+compatibility, and should only be used to control the value of the
+.Li FPCSR_FS
+bit in the floating-point control register.
+Portable code should use the
+.Nm fpgetmask ,
+.Nm fpgetround ,
+.Nm fpgetsticky ,
+.Nm fpsetmask ,
+.Nm fpsetround
+and
+.Nm fpsetsticky
+functions to inquire or alter the floating-point control register.
+.Sh RETURN VALUES
+The
+.Nm get_fpc_csr
+and
+.Nm set_fpc_csr
+functions return the
+.Pq previous
+value of the floating-point control register.
+.Sh SEE ALSO
+.Xr fpgetmask 2 ,
+.Xr fpgetround 2 ,
+.Xr fpgetsticky 2 ,
+.Xr fpsetmask 2 ,
+.Xr fpsetround 2 ,
+.Xr fpsetsticky 2