bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getcontext() masks FP exceptions as side effect


From: Ed Connell
Subject: getcontext() masks FP exceptions as side effect
Date: Mon, 9 Dec 2002 15:39:14 -0500

Hi,

On x86, getcontext() grabs the current FPU environment with
'fnstenv'.  This instruction has the side effect of masking all
floating point exceptions whether they were previously masked or
not.  I'm guessing this is not the intended semantics of
getcontext().

In sysdeps/unix/sysv/linux/i386/getcontext.S (line 52) after

        /* We have separate floating-point register content memory on the
           stack.  We use the __fpregs_mem block in the context.  Set the
           links up correctly.  */
        leal    oFPREGSMEM(%eax), %ecx
        movl    %ecx, oFPREGS(%eax)
        /* Save the floating-point context.  */
        fnstenv (%ecx)

perhaps we should add

        fldenv (%ecx)

so we keep the same FP exceptions masked.  Don't quote me though;
I'm not a x86 assembly guy.

Thanks
Ed



reply via email to

[Prev in Thread] Current Thread [Next in Thread]