Module Name: src Committed By: dsl Date: Wed Feb 12 23:04:43 UTC 2014
Modified Files: src/sys/arch/amd64/include: fenv.h src/sys/arch/i386/include: fenv.h Log Message: 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? To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/include/fenv.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/include/fenv.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/include/fenv.h diff -u src/sys/arch/amd64/include/fenv.h:1.2 src/sys/arch/amd64/include/fenv.h:1.3 --- src/sys/arch/amd64/include/fenv.h:1.2 Tue Feb 11 20:17:16 2014 +++ src/sys/arch/amd64/include/fenv.h Wed Feb 12 23:04:43 2014 @@ -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 @@ extern fenv_t __fe_dfl_env; * the user to affect the subsequent behavior of floating-point arithmetic. */ typedef uint32_t fexcept_t; +#endif #endif /* ! _AMD64_FENV_H_ */ Index: src/sys/arch/i386/include/fenv.h diff -u src/sys/arch/i386/include/fenv.h:1.1 src/sys/arch/i386/include/fenv.h:1.2 --- src/sys/arch/i386/include/fenv.h:1.1 Sat Jul 31 21:47:54 2010 +++ src/sys/arch/i386/include/fenv.h Wed Feb 12 23:04:43 2014 @@ -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 @@ extern fenv_t __fe_dfl_env; * the user to affect the subsequent behavior of floating-point arithmetic. */ typedef uint32_t fexcept_t; +#endif #endif /* ! _X86_FENV_H_ */