linux-mips-fnet
[Top] [All Lists]

Re: [patch] linux: Report the faulting FPU instruction

To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Subject: Re: [patch] linux: Report the faulting FPU instruction
From: Ralf Baechle <ralf@oss.sgi.com>
Date: Tue, 27 Nov 2001 12:13:37 +1100
Cc: linux-mips@fnet.fr, linux-mips@oss.sgi.com
In-reply-to: <Pine.GSO.3.96.1011126160822.21598N-100000@delta.ds2.pg.gda.pl>; from macro@ds2.pg.gda.pl on Mon, Nov 26, 2001 at 04:28:34PM +0100
References: <Pine.GSO.3.96.1011126160822.21598N-100000@delta.ds2.pg.gda.pl>
User-agent: Mutt/1.2.5i
On Mon, Nov 26, 2001 at 04:28:34PM +0100, Maciej W. Rozycki wrote:

>  I believe it's desireable to point to the faulting instruction upon an
> FPU trap and not the following one.  Why?  First, the FPU restores the
> state from before attempting to exectute the instruction.  Second, with
> the current approach state is lost -- consider instructions in branch/jump
> delay slots.  Third, erroneous execution is possible if SIG_FPE's handler
> is set to "ignore" by mistake.
> 
>  The following patch implements the described approach.  It should not
> affect standard handlers which use setjmp()/longjmp(), but it should
> enable a smarter interpreting handler or just better diagnostics.  Both
> the hardware and the emulator are handled.  Tested successfully with gdb
> on an R3k, an R4k and the emulator. 

The problem you found in the FPU emulator is a fairly generic one.  We
got other exception handlers which in error case will still skip over
the instruction.  What also isn't handled properly is the case of sending
a signal to the application.  In such a case sigreturn() should do the
the compute_return_epc() thing ...

  Ralf

<Prev in Thread] Current Thread [Next in Thread>