Re: [hatari-devel] Wrong bus error stack frame with 68000 and JSR

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


Le 19/03/2024 à 21:45, Christian Zietz a écrit :
Hi,

the following bug report is probably something for Toni, but I don't
know how to reach him.

I investigated why Spectre (the Mac emulator) crashes under Hatari. This
has been reported before, but never resolved or investigated in detail
as far as I can see:
https://www.atari-forum.com/viewtopic.php?p=451553#p451553

I have found out that it crashes while handling an expected bus error,
because the stack frame is different on Hatari compared to a real 68000.

Consider the case where a JSR is executed to a target address that
causes a bus error. This happens on the emulated Macintosh, when
something tries to jump into the Mac ROM above 0x400000. Spectre has
code to handle this, but it chokes on the incorrect stack frame.

A test program is attached, as well as results from a real 68000 (.jpg)
and from Hatari's 68000 emulation (.png). As you can see, on Hatari the
stacked PC is the address that causes the exception (0x401234 in my test
program), i.e., *after* the JSR. Whereas on the real 68000 the stacked
PC is still in ST-RAM, i.e., *before* the JSR.

Note that this is not a regression. A similar crash is observed with
Hatari 2.4. Nevertheless, I think it should be fixed.

Regards
Christian


Hi

thanks for your test, this look indeed like an error.

Toni has written a rather extensive "cpu validator" program that runs on real amiga and on WinUAE and by comparing real HW vs emulation this helped in the past finding non correctly emulated features (such as undocumented behaviour for ZCNV bits, wrong value on the stack and so on)

But as Amiga doesn't really use bus error (except for some external board), it's quite possible some cases were missed.

Anyway, I'm cc'ing Toni, but I'm sure the subject of your mail alone would catch his attention as he's subscribed to this mailing list :)

Nicolas




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