Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src * New MI man page for fp{set, get}{round, sticky, mask}(3).



details:   https://anonhg.NetBSD.org/src/rev/e64f2def025a
branches:  trunk
changeset: 472457:e64f2def025a
user:      ross <ross%NetBSD.org@localhost>
date:      Fri Apr 30 00:58:30 1999 +0000

description:
* New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha.  (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.

diffstat:

 distrib/sets/lists/comp/md.alpha      |    3 +-
 distrib/sets/lists/comp/mi            |   14 +++-
 lib/libc/arch/alpha/gen/fpgetmask.c   |   13 +-
 lib/libc/arch/alpha/gen/fpgetsticky.c |   15 ++-
 lib/libc/arch/alpha/gen/fpsetmask.c   |   12 +-
 lib/libc/arch/alpha/gen/fpsetsticky.c |   12 +-
 lib/libc/gen/Makefile.inc             |    5 +-
 lib/libc/gen/fpgetmask.3              |  131 ++++++++++++++++++++++++++++++++++
 sys/arch/alpha/alpha/sys_machdep.c    |   21 ++++-
 sys/arch/alpha/include/Makefile       |    6 +-
 sys/arch/alpha/include/sysarch.h      |   23 +++++
 11 files changed, 222 insertions(+), 33 deletions(-)

diffs (truncated from 456 to 300 lines):

diff -r 3e1f7c3299bc -r e64f2def025a distrib/sets/lists/comp/md.alpha
--- a/distrib/sets/lists/comp/md.alpha  Fri Apr 30 00:52:58 1999 +0000
+++ b/distrib/sets/lists/comp/md.alpha  Fri Apr 30 00:58:30 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.alpha,v 1.18 1999/04/19 04:20:13 ross Exp $
+# $NetBSD: md.alpha,v 1.19 1999/04/30 00:58:30 ross Exp $
 ./usr/include/alpha
 ./usr/include/alpha/_G_config.h
 ./usr/include/alpha/alpha_cpu.h
@@ -49,3 +49,4 @@
 ./usr/include/alpha/vmparam.h
 ./usr/include/alpha/vuid_event.h
 ./usr/include/alpha/z8530var.h
+./usr/include/alpha/sysarch.h
diff -r 3e1f7c3299bc -r e64f2def025a distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Fri Apr 30 00:52:58 1999 +0000
+++ b/distrib/sets/lists/comp/mi        Fri Apr 30 00:58:30 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.136 1999/04/19 03:11:34 simonb Exp $
+# $NetBSD: mi,v 1.137 1999/04/30 00:58:30 ross Exp $
 ./sys
 ./usr/bin/ar
 ./usr/bin/as
@@ -1562,7 +1562,13 @@
 ./usr/share/man/cat3/fopen.0
 ./usr/share/man/cat3/forkpty.0
 ./usr/share/man/cat3/fparseln.0
+./usr/share/man/cat3/fpgetmask.0
+./usr/share/man/cat3/fpgetround.0
+./usr/share/man/cat3/fpgetsticky.0
 ./usr/share/man/cat3/fprintf.0
+./usr/share/man/cat3/fpsetmask.0
+./usr/share/man/cat3/fpsetround.0
+./usr/share/man/cat3/fpsetsticky.0
 ./usr/share/man/cat3/fpurge.0
 ./usr/share/man/cat3/fputc.0
 ./usr/share/man/cat3/fputs.0
@@ -2606,7 +2612,13 @@
 ./usr/share/man/man3/fopen.3
 ./usr/share/man/man3/forkpty.3
 ./usr/share/man/man3/fparseln.3
+./usr/share/man/man3/fpgetmask.3
+./usr/share/man/man3/fpgetround.3
+./usr/share/man/man3/fpgetsticky.3
 ./usr/share/man/man3/fprintf.3
+./usr/share/man/man3/fpsetmask.3
+./usr/share/man/man3/fpsetround.3
+./usr/share/man/man3/fpsetsticky.3
 ./usr/share/man/man3/fpurge.3
 ./usr/share/man/man3/fputc.3
 ./usr/share/man/man3/fputs.3
diff -r 3e1f7c3299bc -r e64f2def025a lib/libc/arch/alpha/gen/fpgetmask.c
--- a/lib/libc/arch/alpha/gen/fpgetmask.c       Fri Apr 30 00:52:58 1999 +0000
+++ b/lib/libc/arch/alpha/gen/fpgetmask.c       Fri Apr 30 00:58:30 1999 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: fpgetmask.c,v 1.1 1995/04/29 05:10:55 cgd Exp $        */
+/*     $NetBSD: fpgetmask.c,v 1.2 1999/04/30 00:58:31 ross Exp $       */
 
 /*
- * Copyright (c) 1995 Christopher G. Demetriou
+ * Copyright (c) 1999 Ross Harvey
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *      This product includes software developed by Christopher G. Demetriou
+ *      This product includes software developed by Ross Harvey
  *     for the NetBSD Project.
  * 4. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission
@@ -32,11 +32,10 @@
  */
 
 #include <ieeefp.h>
+#include <machine/sysarch.h>
 
 fp_except
-fpgetmask()
+fpgetmask __P((void))
 {
-
-       /* XXX */
-       abort();
+       return sysarch(ALPHA_FPGETMASK, (void *)0);
 }
diff -r 3e1f7c3299bc -r e64f2def025a lib/libc/arch/alpha/gen/fpgetsticky.c
--- a/lib/libc/arch/alpha/gen/fpgetsticky.c     Fri Apr 30 00:52:58 1999 +0000
+++ b/lib/libc/arch/alpha/gen/fpgetsticky.c     Fri Apr 30 00:58:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpgetsticky.c,v 1.1 1995/04/29 05:10:59 cgd Exp $      */
+/*     $NetBSD: fpgetsticky.c,v 1.2 1999/04/30 00:58:31 ross Exp $     */
 
 /*
  * Copyright (c) 1995 Christopher G. Demetriou
@@ -31,12 +31,19 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/types.h>
 #include <ieeefp.h>
 
 fp_except
-fpgetsticky()
+fpgetsticky __P((void))
 {
+       double fpcrval;
+       u_int64_t old;
 
-       /* XXX */
-       abort();
+       __asm__("trapb");
+       __asm__("mf_fpcr %0" : "=f" (fpcrval));
+       __asm__("trapb");
+       old = *(u_int64_t *)&fpcrval;
+
+       return (old >> 52) & 0x3f;
 }
diff -r 3e1f7c3299bc -r e64f2def025a lib/libc/arch/alpha/gen/fpsetmask.c
--- a/lib/libc/arch/alpha/gen/fpsetmask.c       Fri Apr 30 00:52:58 1999 +0000
+++ b/lib/libc/arch/alpha/gen/fpsetmask.c       Fri Apr 30 00:58:30 1999 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: fpsetmask.c,v 1.1 1995/04/29 05:11:01 cgd Exp $        */
+/*     $NetBSD: fpsetmask.c,v 1.2 1999/04/30 00:58:31 ross Exp $       */
 
 /*
- * Copyright (c) 1995 Christopher G. Demetriou
+ * Copyright (c) 1995 Ross Harvey
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *      This product includes software developed by Christopher G. Demetriou
+ *      This product includes software developed by Ross Harvey
  *     for the NetBSD Project.
  * 4. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission
@@ -32,12 +32,14 @@
  */
 
 #include <ieeefp.h>
+#include <machine/sysarch.h>
 
 fp_except
 fpsetmask(mask)
        fp_except mask;
 {
+       struct alpha_fp_except_args a;
 
-       /* XXX */
-       abort();
+       a.mask = mask;
+       return sysarch(ALPHA_FPSETMASK, &a);
 }
diff -r 3e1f7c3299bc -r e64f2def025a lib/libc/arch/alpha/gen/fpsetsticky.c
--- a/lib/libc/arch/alpha/gen/fpsetsticky.c     Fri Apr 30 00:52:58 1999 +0000
+++ b/lib/libc/arch/alpha/gen/fpsetsticky.c     Fri Apr 30 00:58:30 1999 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: fpsetsticky.c,v 1.1 1995/04/29 05:11:04 cgd Exp $      */
+/*     $NetBSD: fpsetsticky.c,v 1.2 1999/04/30 00:58:31 ross Exp $     */
 
 /*
- * Copyright (c) 1995 Christopher G. Demetriou
+ * Copyright (c) 1999 Ross Harvey
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *      This product includes software developed by Christopher G. Demetriou
+ *      This product includes software developed by Ross Harvey
  *     for the NetBSD Project.
  * 4. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission
@@ -32,12 +32,14 @@
  */
 
 #include <ieeefp.h>
+#include <machine/sysarch.h>
 
 fp_except
 fpsetsticky(sticky)
        fp_except sticky;
 {
+       struct alpha_fp_except_args a;
 
-       /* XXX */
-       abort();
+       a.mask = sticky;
+       return sysarch(ALPHA_FPSETSTICKY, &a);
 }
diff -r 3e1f7c3299bc -r e64f2def025a lib/libc/gen/Makefile.inc
--- a/lib/libc/gen/Makefile.inc Fri Apr 30 00:52:58 1999 +0000
+++ b/lib/libc/gen/Makefile.inc Fri Apr 30 00:58:30 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.97 1999/02/24 15:05:20 drochner Exp $
+#      $NetBSD: Makefile.inc,v 1.98 1999/04/30 00:58:31 ross Exp $
 #      from: @(#)Makefile.inc  8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -38,7 +38,7 @@
 
 MAN+=  alarm.3 basename.3 bswap.3 clock.3 confstr.3 ctermid.3 ctype.3 \
        daemon.3 devname.3 directory.3 dirname.3 err.3 exec.3 \
-       fnmatch.3 frexp.3 ftok.3 fts.3 getbsize.3 getcap.3 \
+       fnmatch.3 fpgetmask.3 frexp.3 ftok.3 fts.3 getbsize.3 getcap.3 \
        getcwd.3 getdomainname.3 getdiskbyname.3 getfsent.3 \
        getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \
        getmntinfo.3 getnetgrent.3 getpagesize.3 getpass.3 \
@@ -53,6 +53,7 @@
        timezone.3 toascii.3 tolower.3 toupper.3 ttyname.3 \
        ualarm.3 uname.3 unvis.3 usleep.3 utime.3 valloc.3 vis.3
 
+MLINKS+=fpgetround.3 fpgetsticky.3 fpsetmask.3 fpsetround.3 fpsetsticky.3
 MLINKS+=bswap.3 bswap16.3
 MLINKS+=bswap.3 bswap32.3
 MLINKS+=bswap.3 bswap64.3
diff -r 3e1f7c3299bc -r e64f2def025a lib/libc/gen/fpgetmask.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/gen/fpgetmask.3  Fri Apr 30 00:58:30 1999 +0000
@@ -0,0 +1,131 @@
+.\"    $NetBSD: fpgetmask.3,v 1.1 1999/04/30 00:58:31 ross Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Ross Harvey.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"        This product includes software developed by the NetBSD
+.\"        Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\"    contributors may be used to endorse or promote products derived
+.\"    from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd April 29, 1999
+.Dt FPGETMASK 3
+.Os
+.Sh NAME
+.Nm fpgetmask ,
+.Nm fpgetround ,
+.Nm fpgetsticky ,
+.Nm fpsetmask ,
+.Nm fpsetround ,
+.Nm fpsetsticky
+.Nd IEEE FP mode control
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.Fd #include <ieeefp.h>
+.Ft fp_except
+.Fn fpgetmask void
+.Ft fp_rnd
+.Fn fpgetround void
+.Ft fp_except
+.Fn fpgetsticky void
+.Ft fp_except
+.Fn fpsetmask fp_except\ mask
+.Ft fp_rnd
+.Fn fpsetround fp_rnd\ rnd_dir
+.Ft fp_except
+.Fn fpsetsticky fp_except\ sticky
+.Sh DESCRIPTION
+A rounding mode is one of
+.Dv FP_RZ , FP_RM , FP_RN ,
+or
+.Dv FP_RP ,
+for rounding towards zero, rounding
+.Pq Em Minus infinity
+down, rounding to
+.Em nearest ,



Home | Main Index | Thread Index | Old Index