#12873: Clear FPU in i386/x86_64 longjmp()
----------------------------------+-----------------------------------------
Reporter: jdemeyer | Owner: jdemeyer
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.0
Component: c_lib | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Jeroen Demeyer | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Description changed by jdemeyer:
Old description:
> The libc `setjmp`/`longjmp` functions on i386/x86_64 hardware do not
> restore the 387 FPU state, in particular when MMX instructions have been
> used. On Linux and OS X 10.6, the FPU state is restored when an
> interrupt occurs, but on Solaris this is not the case.
>
> The proposed solution is to clear the FPU (using the `EMMS` or `FFREE`
> instructions) in the signal handler. For more context, see #12777 where
> this bug was discovered.
>
> To see the problem in action, compile [attachment:emms.c] on i686
> hardware with
> {{{
> gcc -march=pentium2 -m32 -mfpmath=387 -lm emms.c -o emms
> }}}
>
> '''Apply''' [attachment:12873_emms.patch]
New description:
If an interrupt occurs during a 387 FPU computation or during an MMX
computation (which also uses the FPU registers), then some of the FPU
registers will be occupied. This may lead to failures with subsequent FPU
compuations, see for example #12777. Some operating systems (e.g. Linux
and OS X 10.6) restore the FPU state when an interrupt occurs, but on
Solaris this is not the case.
The proposed solution is to clear the FPU "tag word" (using the `EMMS` or
`FFREE` instructions) in the signal handler.
To see the problem in action, compile [attachment:emms.c] on i686 hardware
with
{{{
gcc -march=pentium2 -m32 -mfpmath=387 -lm emms.c -o emms
}}}
'''Apply''' [attachment:12873_emms.patch]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12873#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.