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