Re: [hatari-devel] Natfeats regression?

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


Am Thu, 16 Jun 2022 10:57:22 +0200
schrieb Christian Zietz <czietz@xxxxxxx>:

> Matthias Arndt schrieb:
> 
> > My problem is that it does not seem to be an Atari side crash as
> > Hatari itself locks up, SDL GUI is unresponsive and there is no
> > jump to the debugger on the console. I have to manually kill hatari
> > from a different shell.
> >
> > Find attached a sample harddisk image that should demonstrate the
> > crash. It's my Harddisk menu btw.  
> 
> Adding "--trace natfeats" to the Hatari command line shows that it
> ends up stuck in an endless loop trying to do NF_STDERR:
> 
> [...]
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> NF_STDERR(0xb7f4a )
> [...]
> 
> Now, without the source code to your program, it's hard to tell what
> you're doing there. *However*, I can reproduce similar behavior by
> calling nf_print("") [1], i.e., invoking NF_STDERR with an empty
> string. The stack trace is as follows:
> 
> > hatari_win64_debug!nf_stderr+0x21
> > [\home\hatari\hatari-builder2\hatari\src\debug\natfeats.c @ 139]
> > hatari_win64_debug!NatFeat_Call+0x60
> > [\home\hatari\hatari-builder2\hatari\src\debug\natfeats.c @ 358]
> > hatari_win64_debug!OpCode_NatFeat_Call+0x2b
> > [\home\hatari\hatari-builder2\hatari\src\cpu\hatari-glue.c @ 350]
> > hatari_win64_debug!m68k_run_1_ce+0x22e
> > [\home\hatari\hatari-builder2\hatari\src\cpu\newcpu.c @ 5431]
> > hatari_win64_debug!m68k_go+0x266
> > [\home\hatari\hatari-builder2\hatari\src\cpu\newcpu.c @ 7628]  
> 
> Here is what I think happens: The NF_STDERR handler [2] calls
> mem_string_ok() [3]. This function returns 0 for an empty string,
> which causes nf_stderr() to return false. This in turn causes the CPU
> *not* to advance its PC, as it will only do a (fake) NOP when the
> natfeats call is successful [4]. Thus, the natfeats instruction is
> repeated over and over again.

I init the id once and then use this to pass my output.
I used Eero's example code and just added my own wrappers.

This should be the same as described here:
https://www.atari-forum.com/viewtopic.php?p=293615#p293615

From what I see I didn't change much, maybe some additions.

As there is output visible on my console, I don't assume my old code is
at fault as it does output some lines as intended.


> 
> > (I have an older build of hatari as backup where Natfeats work so
> > my work is not affected.)  
> 
> But this statement of yours confuses me. According to "git blame" the
> corresponding code has not changed in years. How old is your "older
> build"?

$ /opt/hatari/bin/hatari-2017-07-19 --debug-except all,autostart -w
--natfeats true -d example_hd/ Native Features enabled.
Video_SetSystemTimings1 2 3
Video_SetSystemTimings2 2 3 -> 4 (STE) 500 500 64
Hatari v2.0.0, compiled on:  Jul 19 2017, 18:30:58

5 years or so? ;)

The code under test is of the same vintage and basically unchanged
since 2016/17

Best regards,
Matthias


-- 
https://final-memory.org/



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