Source-Changes-HG archive

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

[src/trunk]: src/lib/libc Add SIGFPE support to SoftFloat, so fpsetmask/fpget...



details:   https://anonhg.NetBSD.org/src/rev/0631bfcd6a6e
branches:  trunk
changeset: 526827:0631bfcd6a6e
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sun May 12 13:12:45 2002 +0000

description:
Add SIGFPE support to SoftFloat, so fpsetmask/fpgetmask now work.  A new
variable, float_exception_mask (#defined to _softfloat_float_exception_mask)
contains the current exception mask.
Also make the argument to float_raise into an fp_except.
Also synchronise file header comments between files.

diffstat:

 lib/libc/arch/arm/softfloat/softfloat.h     |   6 +++++-
 lib/libc/arch/powerpc/softfloat/softfloat.h |   6 +++++-
 lib/libc/arch/sh3/softfloat/softfloat.h     |   7 +++++--
 lib/libc/arch/sparc64/softfloat/softfloat.h |   6 +++++-
 lib/libc/softfloat/fpgetmask.c              |   6 +++---
 lib/libc/softfloat/fpsetmask.c              |   9 ++++++---
 lib/libc/softfloat/softfloat-for-gcc.h      |   3 ++-
 lib/libc/softfloat/softfloat-specialize     |  11 ++++++++++-
 8 files changed, 41 insertions(+), 13 deletions(-)

diffs (215 lines):

diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/arch/arm/softfloat/softfloat.h
--- a/lib/libc/arch/arm/softfloat/softfloat.h   Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/arch/arm/softfloat/softfloat.h   Sun May 12 13:12:45 2002 +0000
@@ -1,3 +1,6 @@
+/*     $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $      */
+
+/* This is a derivative work. */
 
 /*
 ===============================================================================
@@ -92,6 +95,7 @@
 -------------------------------------------------------------------------------
 */
 extern fp_except float_exception_flags;
+extern fp_except float_exception_mask;
 enum {
     float_flag_inexact   = FP_X_IMP,
     float_flag_underflow = FP_X_UFL,
@@ -106,7 +110,7 @@
 exception flags.
 -------------------------------------------------------------------------------
 */
-void float_raise( int );
+void float_raise( fp_except );
 
 /*
 -------------------------------------------------------------------------------
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/arch/powerpc/softfloat/softfloat.h
--- a/lib/libc/arch/powerpc/softfloat/softfloat.h       Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/arch/powerpc/softfloat/softfloat.h       Sun May 12 13:12:45 2002 +0000
@@ -1,3 +1,6 @@
+/*     $NetBSD: softfloat.h,v 1.3 2002/05/12 13:12:46 bjh21 Exp $      */
+
+/* This is a derivative work. */
 
 /*
 ===============================================================================
@@ -92,6 +95,7 @@
 -------------------------------------------------------------------------------
 */
 extern fp_except float_exception_flags;
+extern fp_except float_exception_mask;
 enum {
     float_flag_inexact   = FP_X_IMP,
     float_flag_underflow = FP_X_UFL,
@@ -106,7 +110,7 @@
 exception flags.
 -------------------------------------------------------------------------------
 */
-void float_raise( int8 );
+void float_raise( fp_except );
 
 /*
 -------------------------------------------------------------------------------
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/arch/sh3/softfloat/softfloat.h
--- a/lib/libc/arch/sh3/softfloat/softfloat.h   Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/arch/sh3/softfloat/softfloat.h   Sun May 12 13:12:45 2002 +0000
@@ -1,4 +1,6 @@
-/*     $NetBSD: softfloat.h,v 1.6 2002/05/06 19:05:01 bjh21 Exp $      */
+/*     $NetBSD: softfloat.h,v 1.7 2002/05/12 13:12:47 bjh21 Exp $      */
+
+/* This is a derivative work. */
 
 /*
 ===============================================================================
@@ -93,6 +95,7 @@
 -------------------------------------------------------------------------------
 */
 extern fp_except float_exception_flags;
+extern fp_except float_exception_mask;
 enum {
     float_flag_inexact   = FP_X_IMP,
     float_flag_underflow = FP_X_UFL,
@@ -107,7 +110,7 @@
 exception flags.
 -------------------------------------------------------------------------------
 */
-void float_raise( int8 );
+void float_raise( fp_except );
 
 /*
 -------------------------------------------------------------------------------
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/arch/sparc64/softfloat/softfloat.h
--- a/lib/libc/arch/sparc64/softfloat/softfloat.h       Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/arch/sparc64/softfloat/softfloat.h       Sun May 12 13:12:45 2002 +0000
@@ -1,3 +1,6 @@
+/*     $NetBSD: softfloat.h,v 1.4 2002/05/12 13:12:47 bjh21 Exp $      */
+
+/* This is a derivative work. */
 
 /*
 ===============================================================================
@@ -94,6 +97,7 @@
 -------------------------------------------------------------------------------
 */
 extern fp_except float_exception_flags;
+extern fp_except float_exception_mask;
 enum {
     float_flag_inexact   = FP_X_IMP,
     float_flag_underflow = FP_X_UFL,
@@ -108,7 +112,7 @@
 exception flags.
 -------------------------------------------------------------------------------
 */
-void float_raise( int8 );
+void float_raise( fp_except );
 
 /*
 -------------------------------------------------------------------------------
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/softfloat/fpgetmask.c
--- a/lib/libc/softfloat/fpgetmask.c    Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/softfloat/fpgetmask.c    Sun May 12 13:12:45 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpgetmask.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $ */
+/* $NetBSD: fpgetmask.c,v 1.3 2002/05/12 13:12:45 bjh21 Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetmask.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $");
+__RCSID("$NetBSD: fpgetmask.c,v 1.3 2002/05/12 13:12:45 bjh21 Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -58,5 +58,5 @@
 fpgetmask(void)
 {
 
-       return 0;
+       return float_exception_mask;
 }
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/softfloat/fpsetmask.c
--- a/lib/libc/softfloat/fpsetmask.c    Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/softfloat/fpsetmask.c    Sun May 12 13:12:45 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetmask.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $ */
+/* $NetBSD: fpsetmask.c,v 1.3 2002/05/12 13:12:45 bjh21 Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetmask.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $");
+__RCSID("$NetBSD: fpsetmask.c,v 1.3 2002/05/12 13:12:45 bjh21 Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -57,6 +57,9 @@
 fp_except
 fpsetmask(fp_except mask)
 {
+       fp_except old;
 
-       return 0;
+       old = float_exception_mask;
+       float_exception_mask = mask;
+       return old;
 }
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/softfloat/softfloat-for-gcc.h
--- a/lib/libc/softfloat/softfloat-for-gcc.h    Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/softfloat/softfloat-for-gcc.h    Sun May 12 13:12:45 2002 +0000
@@ -1,10 +1,11 @@
-/* $NetBSD: softfloat-for-gcc.h,v 1.4 2001/03/08 18:56:19 bjh21 Exp $ */
+/* $NetBSD: softfloat-for-gcc.h,v 1.5 2002/05/12 13:12:45 bjh21 Exp $ */
 
 /*
  * Move private identifiers with external linkage into implementation
  * namespace.  -- Klaus Klein <kleink%netbsd.org@localhost>, May 5, 1999
  */
 #define float_exception_flags  _softfloat_float_exception_flags
+#define float_exception_mask   _softfloat_float_exception_mask
 #define float_rounding_mode    _softfloat_float_rounding_mode
 #define float_raise            _softfloat_float_raise
 /* The following batch are called by GCC through wrappers */
diff -r c02d168931b6 -r 0631bfcd6a6e lib/libc/softfloat/softfloat-specialize
--- a/lib/libc/softfloat/softfloat-specialize   Sun May 12 12:52:58 2002 +0000
+++ b/lib/libc/softfloat/softfloat-specialize   Sun May 12 13:12:45 2002 +0000
@@ -1,3 +1,6 @@
+/*     $NetBSD: softfloat-specialize,v 1.3 2002/05/12 13:12:45 bjh21 Exp $     */
+
+/* This is a derivative work. */
 
 /*
 ===============================================================================
@@ -29,6 +32,8 @@
 ===============================================================================
 */
 
+#include <signal.h>
+
 /*
 -------------------------------------------------------------------------------
 Underflow tininess-detection mode, statically initialized to default value.
@@ -48,11 +53,15 @@
 should be simply `float_exception_flags |= flags;'.
 -------------------------------------------------------------------------------
 */
-void float_raise( int8 flags )
+fp_except float_exception_mask = 0;
+void float_raise( fp_except flags )
 {
 
     float_exception_flags |= flags;
 
+    if ( flags & float_exception_mask ) {
+       raise( SIGFPE );
+    }
 }
 
 /*



Home | Main Index | Thread Index | Old Index