cvs commit: src/sys/i386/include npx.h src/sys/i386/i386
vm_machdep.c src/sys/i386/isa npx.c
Bruce Evans
bde at zeta.org.au
Sun May 28 02:00:07 PDT 2006
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
More information about the cvs-src
mailing list