Re: [hatari-devel] DSP endless loop

[ Thread Index | Date Index | More Archives ]

Am 06.05.2017 um 08:18 schrieb Andreas Grabher <andreas.grabher@xxxxxxxxxxxx>:

Miro and Douglas, thank you very much for checking! 

Am 06.05.2017 um 03:13 schrieb Douglas Little <doug694@xxxxxxxxxxxxxx>:


I have a appended disassembly output from a DSP program that seems to go to an endless loop, which freezes the whole operating system. It is a long time ago i last debugged the DSP. Maybe someone with more experience sees the problem. If the problem is within DSP emulation it potentially affects Hatari too.

Are you sure it's going into an endless loop? The trace shows the program transfers a bunch of data/code and then goes into a polling loop waiting for something else to do. It's late to debug this properly - but it doesn't look like its necessarily broken (on the DSP side anyway).

Your suspicion was right. Obviously i was not waiting long enough (things are really slow in trace mode). It continues and then goes to another loop, which is much more complex. If it is not a DSP problem it might be a problem on the host side (probably a timing problem?). I appended another trace output. But i'm not sure it is useful.

I found the problem. It is a timing issue. My system is too slow to run 68k + DSP in realtime. While the DSP is running performance of the 68040 drops to about 20 % in debugging mode and 40 % in normal mode. I recognized that for some reason the program does not fail on the 68030. The 68030 performance does not drop that far (around 70 %). So finally the problem seems to be this: While performance of the system drops to a fraction of normal speed, the timers (hardclock, event counter) are bound to host time and continue running at normal speed. That causes a situation where the frequency of DSP interrupts gets too high for the system to manage (after servicing an interrupt the next one is immediately following) and ultimately freezes the system.

Thank you for having a look at the traces. 

However you might want to make sure the DO loops are correct. I spotted some flow control instructions (jmp/jsr etc) near DO labels and this isn't allowed for those kinds of instructions - undefined behaviour. Put some nops before/after the do labels to test that.

Other than doubts about the DO loops it's probably the host program losing sync, not handshaking properly or just sending the wrong data.



Mail converted by MHonArc 2.6.19+