Re: [hatari-devel] Possible bug in 060 exception stack frames

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 18/01/2021 à 21:10, Toni Wilen a écrit :
Documentation says:

--
6.6.2.2 TRAP ENABLED RESULTS (FPCR SNAN BIT SET).

If the destination is not a floating-point data register (FMOVE OUT
instruction), the destination (memory or integer data register) is
written with the same data as though the trap were disabled (FPCR SNAN
bit clear), and then control is passed to the user SNAN handler as a
post-instruction exception. If desired, the user SNAN handler can
overwrite the result.

For floating-point data register destinations, the source (if
register-to-register instruction) and destination floating-point data
registers are not modified. Control is passed to the user SNAN handler
as a pre-instruction exception when the next floating-point instruction
is encountered. In this case, the SNAN user handler should supply the
result.
--

So according to documentation (Test code has FP0 destination), following
FPU instruction should trigger the SNAN exception. But test code expects
immediate post-instruction exception and gets confused if it gets
delayed until next FPU instruction.

I did some real 68060 tests. As usual, documentation does not want to
tell the whole truth.

It mentions many times something like "Since FMOVE to/from the FPCR,
FPSR, or FPIAR and FMOVEM instructions cannot generate floating-point
exceptions, you can do blahblahblah" but this only means those
instructions can't generate exceptions internally and won't modift FPIAR
(so that FPIAR still points to instruction that caused the exception)
but they do still cause exception if there is pending FPU exception
generated by previous FPU instruction. Even FMOVEM.X does this.

This explains why SNAN, OPERR and DZ tests work.

Patch coming later..

Done.

Testing 68060 FPSP started:
	Unimplemented <ea>...passed
	Unimplemented data type/format...passed
	Non-maskable overflow...passed
	Non-maskable underflow...passed
Testing 68060 FPSP unimplemented instruction started:
	Unimplemented FP instructions...passed
Testing 68060 FPSP exception enabled started:
	Enabled SNAN...passed
	Enabled OPERR...passed
	Enabled overflow...passed
	Enabled underflow...passed
	Enabled DZ...passed
	Enabled inexact...passed

btw, any idea if 68060 test would work with 68040 FPSP? I guess at least
in theory it should work. (Emulation does not return correct results but
I'd like to have real 68040 results first)

thanks for the quick patch, it's pushed to Hatari

Nicolas




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/