From owner-cvs-all@FreeBSD.ORG Sun May 28 08:59:53 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E798416CC25; Sun, 28 May 2006 08:33:59 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DEB343D48; Sun, 28 May 2006 08:33:59 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout1.pacific.net.au (Postfix) with ESMTP id F2CC532867B; Sun, 28 May 2006 18:33:57 +1000 (EST) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k4S8XtLC017337; Sun, 28 May 2006 18:33:56 +1000 Date: Sun, 28 May 2006 18:33:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: David Xu In-Reply-To: <200605281438.06966.davidxu@freebsd.org> Message-ID: <20060528174007.R20314@delplex.bde.org> References: <200605280203.k4S23DfP053792@repoman.freebsd.org> <20060528134646.V19811@delplex.bde.org> <200605281438.06966.davidxu@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/include npx.h src/sys/i386/i386 vm_machdep.c src/sys/i386/isa npx.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 May 2006 09:00:07 -0000 On Sun, 28 May 2006, David Xu wrote: > On Sunday 28 May 2006 13:15, Bruce Evans wrote: >>> ... >> POSIX seems to require inheriting the entire environment, but this >> change does extra work to disinherit everything except the control >> word(s), except in the fxsr case it is missing the extra work to >> disinherit the status bits in the mxcsr. > > No, pthread_create is not fork, they are different. > http://www.opengroup.org/onlinepubs/009695399/basedefs/fenv.h.html > I think you misunderstood x86's float-pointing status and POSIX float > point environment. No, I know a little about floating point. > POSIX defined following environment flags: > FE_DOWNWARD > FE_TONEAREST > FE_TOWARDZERO > FE_UPWARD These are just a small part of the FP environment. They are a fairly standard part of the control of the environment. FP environments also have status, and there may be any amount of machine-dependent control and status bits. The FP environment main access functions in fenv.h (fegetenv(w) and fesetenv(2)) act on the entire environment. On i386's and amd64's, they are implemented using fnstenv[+stmxcsr] and fldenv[+ldmxcsr]. Using fnstenv and fldenv ensures getting everything although some things might not be needed and fnstenv and fldenv might be less efficient than alternatives. See fenv.h.html for these details expression in different ways. It defines the "entire floating-point environment" as being [the collection of any status flags and control modes supported by the implementation]. > which when implemented by x86, they are in control word, status word > is nothing to do with new threads, no pending exceptions should be > inherited by new thread. The above rounding flags are in the FP control word and the control part of the mxcsr on i386's. Exception bits are in a separate FP word but in the same mxcsr. Exceptions aren't pending with the default environment; they have happened and are recorded in the exception bits. MD parts of the environment have other things like last-instruction pointers. Using fnstenv and fldenv ensures getting everything, except there are complications for the mxcsr. With only SSE, the environment would just consist of the mxcsr. It may be a bug in POSIX for POSIX to require inheriting the _entire_ FP environment. Perhaps it should require some things to be reset. This is hard for it to even express, since most parts of the FP environment are opaque to it. Your change has the strange behaviour of resetting everything except the mxcsr exception bits. Bruce