Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/sparc64 While we use hardware (for float and d...
details: https://anonhg.NetBSD.org/src/rev/993c1e178347
branches: trunk
changeset: 762942:993c1e178347
user: martin <martin%NetBSD.org@localhost>
date: Sun Mar 06 10:32:47 2011 +0000
description:
While we use hardware (for float and double), but cooperate with softfloat
(to do long double), we need to not only handle the hardware exception
mask and cummulated flags, but also update/query the softfloat variables.
Since this may go away sometime (to make us psABI compliant), ifdef it
properly.
diffstat:
lib/libc/arch/sparc64/Makefile.inc | 4 ++--
lib/libc/arch/sparc64/gen/fpgetsticky.c | 17 ++++++++++++++---
lib/libc/arch/sparc64/gen/fpsetmask.c | 18 +++++++++++++++---
lib/libc/arch/sparc64/gen/fpsetsticky.c | 16 +++++++++++++---
4 files changed, 44 insertions(+), 11 deletions(-)
diffs (146 lines):
diff -r d3f2c7de9910 -r 993c1e178347 lib/libc/arch/sparc64/Makefile.inc
--- a/lib/libc/arch/sparc64/Makefile.inc Sun Mar 06 10:27:37 2011 +0000
+++ b/lib/libc/arch/sparc64/Makefile.inc Sun Mar 06 10:32:47 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.13 2009/12/06 07:05:50 uebayasi Exp $
+# $NetBSD: Makefile.inc,v 1.14 2011/03/06 10:32:47 martin Exp $
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
@@ -36,7 +36,7 @@
.PATH: ${ARCHDIR}/softfloat
SRCS+= qp.c
-CPPFLAGS+= -DSOFTFLOATSPARC64_FOR_GCC
+CPPFLAGS+= -DSOFTFLOATSPARC64_FOR_GCC -DEXCEPTIONS_WITH_SOFTFLOAT
.if ${MKSOFTFLOAT} != "no"
.include <softfloat/Makefile.inc>
.else
diff -r d3f2c7de9910 -r 993c1e178347 lib/libc/arch/sparc64/gen/fpgetsticky.c
--- a/lib/libc/arch/sparc64/gen/fpgetsticky.c Sun Mar 06 10:27:37 2011 +0000
+++ b/lib/libc/arch/sparc64/gen/fpgetsticky.c Sun Mar 06 10:32:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpgetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
+/* $NetBSD: fpgetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -18,11 +18,22 @@
__weak_alias(fpgetsticky,_fpgetsticky)
#endif
+#ifdef EXCEPTIONS_WITH_SOFTFLOAT
+extern fp_except _softfloat_float_exception_flags;
+#endif
+
fp_except
fpgetsticky()
{
int x;
+ fp_except res;
__asm("st %%fsr,%0" : "=m" (*&x));
- return (x >> 5) & 0x1f;
+ res = (x >> 5) & 0x1f;
+
+#ifdef EXCEPTIONS_WITH_SOFTFLOAT
+ res |= _softfloat_float_exception_flags;
+#endif
+
+ return res;
}
diff -r d3f2c7de9910 -r 993c1e178347 lib/libc/arch/sparc64/gen/fpsetmask.c
--- a/lib/libc/arch/sparc64/gen/fpsetmask.c Sun Mar 06 10:27:37 2011 +0000
+++ b/lib/libc/arch/sparc64/gen/fpsetmask.c Sun Mar 06 10:32:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
+/* $NetBSD: fpsetmask.c,v 1.5 2011/03/06 10:32:47 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: fpsetmask.c,v 1.5 2011/03/06 10:32:47 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -18,6 +18,10 @@
__weak_alias(fpsetmask,_fpsetmask)
#endif
+#ifdef EXCEPTIONS_WITH_SOFTFLOAT
+extern fp_except _softfloat_float_exception_mask;
+#endif
+
fp_except
fpsetmask(mask)
fp_except mask;
@@ -33,5 +37,13 @@
__asm("ld %0,%%fsr" : : "m" (*&new));
- return (old >> 23) & 0x1f;
+ old = (old >> 23) & 0x1f;
+
+#ifdef EXCEPTIONS_WITH_SOFTFLOAT
+ /* update softfloat mask as well */
+ old |= _softfloat_float_exception_mask;
+ _softfloat_float_exception_mask = mask;
+#endif
+
+ return old;
}
diff -r d3f2c7de9910 -r 993c1e178347 lib/libc/arch/sparc64/gen/fpsetsticky.c
--- a/lib/libc/arch/sparc64/gen/fpsetsticky.c Sun Mar 06 10:27:37 2011 +0000
+++ b/lib/libc/arch/sparc64/gen/fpsetsticky.c Sun Mar 06 10:32:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
+/* $NetBSD: fpsetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
+__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2011/03/06 10:32:47 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -18,6 +18,10 @@
__weak_alias(fpsetsticky,_fpsetsticky)
#endif
+#ifdef EXCEPTIONS_WITH_SOFTFLOAT
+extern fp_except _softfloat_float_exception_flags;
+#endif
+
fp_except
fpsetsticky(sticky)
fp_except sticky;
@@ -33,5 +37,11 @@
__asm("ld %0,%%fsr" : : "m" (*&new));
- return (old >> 5) & 0x1f;
+ old = (old >> 5) & 0x1f;
+
+#ifdef EXCEPTIONS_WITH_SOFTFLOAT
+ old |= _softfloat_float_exception_flags;
+ _softfloat_float_exception_flags = sticky;
+#endif
+ return old;
}
Home |
Main Index |
Thread Index |
Old Index