diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/alpha/SYS.h | 4 | ||||
-rw-r--r-- | lib/libc/alpha/gen/Makefile.inc | 8 | ||||
-rw-r--r-- | lib/libc/alpha/gen/fpgetmask.c | 11 | ||||
-rw-r--r-- | lib/libc/alpha/gen/fpgetround.c | 7 | ||||
-rw-r--r-- | lib/libc/alpha/gen/fpgetsticky.c | 10 | ||||
-rw-r--r-- | lib/libc/alpha/gen/fpsetmask.c | 12 | ||||
-rw-r--r-- | lib/libc/alpha/gen/fpsetround.c | 17 | ||||
-rw-r--r-- | lib/libc/alpha/gen/fpsetsticky.c | 16 | ||||
-rw-r--r-- | lib/libc/alpha/sys/cerror.S | 6 | ||||
-rw-r--r-- | lib/msun/Makefile | 3 |
10 files changed, 61 insertions, 33 deletions
diff --git a/lib/libc/alpha/SYS.h b/lib/libc/alpha/SYS.h index cfc0909..15b7f8b 100644 --- a/lib/libc/alpha/SYS.h +++ b/lib/libc/alpha/SYS.h @@ -1,4 +1,4 @@ -/* $Id: SYS.h,v 1.2 1998/06/09 22:43:34 jb Exp $ */ +/* $Id: SYS.h,v 1.3 1998/08/08 02:24:03 jb Exp $ */ /* From: NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp */ /* @@ -41,7 +41,7 @@ LLABEL(name,0): \ LDGP(gp); \ beq a3, LLABEL(name,1); \ - jmp zero, cerror; \ + jmp zero, .cerror; \ LLABEL(name,1): diff --git a/lib/libc/alpha/gen/Makefile.inc b/lib/libc/alpha/gen/Makefile.inc index 3ff99f0..cc7a87c 100644 --- a/lib/libc/alpha/gen/Makefile.inc +++ b/lib/libc/alpha/gen/Makefile.inc @@ -1,10 +1,8 @@ -# $Id: Makefile.inc,v 1.3 1998/08/08 02:18:07 jb Exp $ +# $Id: Makefile.inc,v 1.4 1998/08/17 03:38:54 jb Exp $ SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c setjmp.S -SRCS+= flt_rounds.c - -#SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ -# fpsetround.c fpsetsticky.c +SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ + fpsetround.c fpsetsticky.c SRCS+= sigsetjmp.S SRCS+= __divqu.S __divq.S __divlu.S __divl.S diff --git a/lib/libc/alpha/gen/fpgetmask.c b/lib/libc/alpha/gen/fpgetmask.c index c52a7ef..516ae98 100644 --- a/lib/libc/alpha/gen/fpgetmask.c +++ b/lib/libc/alpha/gen/fpgetmask.c @@ -31,12 +31,19 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> #include <ieeefp.h> +#include <machine/sysarch.h> + +struct params { + u_int64_t mask; +}; fp_except fpgetmask() { + struct params p; - /* XXX */ - abort(); + sysarch(ALPHA_GET_FPMASK, (char *) &p); + return((fp_except) p.mask); } diff --git a/lib/libc/alpha/gen/fpgetround.c b/lib/libc/alpha/gen/fpgetround.c index 39b9b47..46976c2 100644 --- a/lib/libc/alpha/gen/fpgetround.c +++ b/lib/libc/alpha/gen/fpgetround.c @@ -33,6 +33,7 @@ #include <sys/types.h> #include <ieeefp.h> +#include <machine/fpu.h> fp_rnd fpgetround() @@ -40,10 +41,8 @@ fpgetround() double fpcrval; u_int64_t old; - __asm__("trapb"); - __asm__("mf_fpcr %0" : "=f" (fpcrval)); - __asm__("trapb"); + GET_FPCR(fpcrval); old = *(u_int64_t *)&fpcrval; - return ((old >> 58) & 0x3); + return ((old & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT); } diff --git a/lib/libc/alpha/gen/fpgetsticky.c b/lib/libc/alpha/gen/fpgetsticky.c index c36db39..c0ff4d7 100644 --- a/lib/libc/alpha/gen/fpgetsticky.c +++ b/lib/libc/alpha/gen/fpgetsticky.c @@ -31,12 +31,18 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> #include <ieeefp.h> +#include <machine/fpu.h> fp_except fpgetsticky() { + double fpcrval; + u_int64_t old; - /* XXX */ - abort(); + GET_FPCR(fpcrval); + old = *(u_int64_t *)&fpcrval; + return (((old >> IEEE_STATUS_TO_FPCR_SHIFT) & IEEE_STATUS_MASK) + >> IEEE_STATUS_TO_EXCSUM_SHIFT); } diff --git a/lib/libc/alpha/gen/fpsetmask.c b/lib/libc/alpha/gen/fpsetmask.c index 87fc5a2..05201ce 100644 --- a/lib/libc/alpha/gen/fpsetmask.c +++ b/lib/libc/alpha/gen/fpsetmask.c @@ -31,13 +31,21 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> #include <ieeefp.h> +#include <machine/sysarch.h> + +struct params { + u_int64_t mask; +}; fp_except fpsetmask(mask) fp_except mask; { + struct params p; - /* XXX */ - abort(); + p.mask = (u_int64_t) mask; + sysarch(ALPHA_SET_FPMASK, (char *) &p); + return ((fp_except) p.mask); } diff --git a/lib/libc/alpha/gen/fpsetround.c b/lib/libc/alpha/gen/fpsetround.c index c28093c..0d8f40a 100644 --- a/lib/libc/alpha/gen/fpsetround.c +++ b/lib/libc/alpha/gen/fpsetround.c @@ -33,6 +33,7 @@ #include <sys/types.h> #include <ieeefp.h> +#include <machine/fpu.h> fp_rnd fpsetround(rnd_dir) @@ -41,18 +42,14 @@ fpsetround(rnd_dir) double fpcrval; u_int64_t old, new; - __asm__("trapb"); - __asm__("mf_fpcr %0" : "=f" (fpcrval)); - __asm__("trapb"); + GET_FPCR(fpcrval); old = *(u_int64_t *)&fpcrval; - new = old & ~(long)0x0c00000000000000; - new = (long)rnd_dir << 58; - *(u_int64_t *)&fpcrval = new; + new = old & (~FPCR_DYN_MASK); + new |= ((long) rnd_dir << FPCR_DYN_SHIFT) & FPCR_DYN_MASK; - __asm__("trapb"); - __asm__("mt_fpcr %0" : : "f" (fpcrval)); - __asm__("trapb"); + *(u_int64_t *)&fpcrval = new; + SET_FPCR(fpcrval); - return ((old >> 58) & 0x3); + return ((old & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT); } diff --git a/lib/libc/alpha/gen/fpsetsticky.c b/lib/libc/alpha/gen/fpsetsticky.c index 90a993e..ae0d742 100644 --- a/lib/libc/alpha/gen/fpsetsticky.c +++ b/lib/libc/alpha/gen/fpsetsticky.c @@ -31,13 +31,25 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> #include <ieeefp.h> +#include <machine/fpu.h> fp_except fpsetsticky(sticky) fp_except sticky; { + double fpcrval; + u_int64_t old,new ; - /* XXX */ - abort(); + GET_FPCR(fpcrval); + old = *(u_int64_t *)&fpcrval; + new = old & ~ (IEEE_STATUS_MASK << IEEE_STATUS_TO_FPCR_SHIFT); + new |= ((sticky << IEEE_STATUS_TO_EXCSUM_SHIFT) & IEEE_STATUS_MASK) + << IEEE_STATUS_TO_FPCR_SHIFT; + *(u_int64_t *)&fpcrval = new; + SET_FPCR(fpcrval); + + return (((old >> IEEE_STATUS_TO_FPCR_SHIFT) & IEEE_STATUS_MASK) + >> IEEE_STATUS_TO_EXCSUM_SHIFT); } diff --git a/lib/libc/alpha/sys/cerror.S b/lib/libc/alpha/sys/cerror.S index cce3006..a3d2b1a 100644 --- a/lib/libc/alpha/sys/cerror.S +++ b/lib/libc/alpha/sys/cerror.S @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: cerror.S,v 1.2 1998/06/09 22:56:24 jb Exp $ */ /* From: NetBSD: cerror.S,v 1.4 1996/11/08 00:52:46 cgd Exp */ /* @@ -34,7 +34,7 @@ #define FRAME_RA_OFFSET 0 #define FRAME_V0_OFFSET 8 -NESTED(cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0) +NESTED(.cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0) br t0, L1 L1: LDGP(t0) @@ -51,4 +51,4 @@ L1: LDGP(t0) ldq ra, FRAME_RA_OFFSET(sp) lda sp, FRAME_SIZE(sp) RET -END(cerror) +END(.cerror) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index a0ca740..c62ee87 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -1,5 +1,5 @@ # @(#)Makefile 5.1beta 93/09/24 -# $Id: Makefile,v 1.19 1997/04/15 14:05:28 bde Exp $ +# $Id: Makefile,v 1.20 1998/02/20 07:44:29 jb Exp $ # # ==================================================== # Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -48,6 +48,7 @@ ARCH_SRCS = s_copysign.S s_copysignf.S # XXX Comment from NetBSD/Alpha: # XXX LINT SIGFPEs in e_exp.c's strtod(). FP underflow/denorm software # handling is broken (doesn't exist!) on the Alpha port. +CFLAGS += -mtrap-precision=i -mfp-trap-mode=su .elif ${MACHINE_ARCH} == "i386" ARCH= i387 ARCH_PREFIX= ${ARCH}_ |