Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add definitions of the default control words direct...



details:   https://anonhg.NetBSD.org/src/rev/178854fe416f
branches:  trunk
changeset: 326684:178854fe416f
user:      dsl <dsl%NetBSD.org@localhost>
date:      Wed Feb 12 23:04:43 2014 +0000

description:
Add definitions of the default control words directly to this file
instead of pulling the kernel definition of the fpu (etc) into
userspace programs.
I've included machine/fenv.h into x86/cpu.c to ensure the duplicated
definitions stay in step.
The default control words are now the hardware defaults.
XXX: Anyone care to explain the differences between the i386 and amd64
versions of this file?

diffstat:

 sys/arch/amd64/include/fenv.h |  17 +++++++++++++++--
 sys/arch/i386/include/fenv.h  |  17 +++++++++++++++--
 2 files changed, 30 insertions(+), 4 deletions(-)

diffs (78 lines):

diff -r a267ea363601 -r 178854fe416f sys/arch/amd64/include/fenv.h
--- a/sys/arch/amd64/include/fenv.h     Wed Feb 12 22:30:45 2014 +0000
+++ b/sys/arch/amd64/include/fenv.h     Wed Feb 12 23:04:43 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fenv.h,v 1.2 2014/02/11 20:17:16 dsl Exp $     */
+/*     $NetBSD: fenv.h,v 1.3 2014/02/12 23:04:43 dsl Exp $     */
 /*-
  * Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
  * All rights reserved.
@@ -28,9 +28,21 @@
 #ifndef _AMD64_FENV_H_
 #define _AMD64_FENV_H_
 
+#ifndef _KERNEL
 #include <sys/stdint.h>
-#include <x86/fpu.h>
+#endif
 
+/* Default x87 control word. */
+#define __INITIAL_NPXCW__       0x037f
+/* Modern NetBSD uses the default control word.. */
+#define __NetBSD_NPXCW__        __INITIAL_NPXCW__
+/* NetBSD before 6.99.26 forced IEEE double precision. */
+#define __NetBSD_COMPAT_NPXCW__ 0x127f
+
+/* Default values for the mxcsr. All traps masked. */
+#define __INITIAL_MXCSR__       0x1f80
+
+#ifndef _KERNEL
 /*
  * Each symbol representing a floating point exception expands to an integer
  * constant expression with values, such that bitwise-inclusive ORs of _all
@@ -103,5 +115,6 @@
  * the user to affect the subsequent behavior of floating-point arithmetic.
  */
 typedef uint32_t fexcept_t;
+#endif
 
 #endif /* ! _AMD64_FENV_H_ */
diff -r a267ea363601 -r 178854fe416f sys/arch/i386/include/fenv.h
--- a/sys/arch/i386/include/fenv.h      Wed Feb 12 22:30:45 2014 +0000
+++ b/sys/arch/i386/include/fenv.h      Wed Feb 12 23:04:43 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fenv.h,v 1.1 2010/07/31 21:47:54 joerg Exp $   */
+/*     $NetBSD: fenv.h,v 1.2 2014/02/12 23:04:43 dsl Exp $     */
 /*-
  * Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
  * All rights reserved.
@@ -28,9 +28,21 @@
 #ifndef        _X86_FENV_H_
 #define        _X86_FENV_H_
 
+#ifndef _KERNEL
 #include <sys/stdint.h>
-#include <i386/npx.h>
+#endif
 
+/* Default x87 control word. */
+#define __INITIAL_NPXCW__       0x037f  
+/* Modern NetBSD uses the default control word.. */
+#define __NetBSD_NPXCW__        __INITIAL_NPXCW__
+/* NetBSD before 6.99.26 forced IEEE double precision. */
+#define __NetBSD_COMPAT_NPXCW__ 0x127f
+
+/* Default values for the mxcsr. All traps masked. */
+#define __INITIAL_MXCSR__       0x1f80
+
+#ifndef _KERNEL
 /*
  * Each symbol representing a floating point exception expands to an integer
  * constant expression with values, such that bitwise-inclusive ORs of _all
@@ -112,5 +124,6 @@
  * the user to affect the subsequent behavior of floating-point arithmetic.
  */
 typedef uint32_t fexcept_t;
+#endif
 
 #endif /* ! _X86_FENV_H_ */



Home | Main Index | Thread Index | Old Index