Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200120173804.GM30412@brightrain.aerifal.cx>
Date: Mon, 20 Jan 2020 12:38:04 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Considering x86-64 fenv.s to C

On Mon, Jan 20, 2020 at 04:32:32PM +1100, Damian McGuckin wrote:
> On Fri, 17 Jan 2020, Rich Felker wrote:
> 
> >Note that this approach is not compatible with trapping
> >exceptions, but we don't support them anyway.
> 
> When an FNSTENV instruction is executed, all pending exceptions are
> essentially lost (either the x87 FPU status register is cleared or
> all exceptions are masked).

I don't follow what you're saying here and suspect you have a
misunderstanding of some of the terms involved. "Pending" does not
mean status flags that are already set. It's a concept from the
original 387 that's irrelevant in later cpu models, whereby an
exception may have already happened on the fpu but still be in transit
to the cpu. Executing fwait first, or fstenv rather than fnstenv, will
ensure that you don't miss anything even on the original 387.

> I think that this means either it wipes the exception bits in the
> status register or it wipes out the bits of the control register
> which handle which exceptions are trapped.
> 
> Am I wrong.

Yes.

> Because MUSL does not support trapping exceptions, we do not need to
> restore the control word.
> 
> But do we need to copy the lost exceptions flags in the x87 register
> back into the SSE register, well at least where we have an SSE.
> 
> Mind you, on an i386 without an SSE, you cannot restore them!

Again, I don't follow.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.