Re: [hatari-devel] fixed a crash when restoring a snapshot using DSP

[ Thread Index | Date Index | More Archives ]

You're right, I've given a closer look at the code, it's not only the memory but all the DSP structure that is impacted (registers state, interrupts, ...) So, the DSP must be in a good state when starting / restarting (but not necessary after a reset).


Le 03/01/2015 17:12, Nicolas Pomarède a écrit :
Le 03/01/2015 17:03, Laurent Sallafranque a écrit :

I don't see a problem with your fix except perhaps in dsp_core_init()
where there's :

     memset(&dsp_core, 0, sizeof(dsp_core_t));

This is here to initialize the dsp memory area with 0 (or NOP
instructions for the P memory).
The DSP memory is not reseted to zero after a reboot, so we just must be
careful to keep this working as it should (ie: correctly init the DSP
memory at first init, but not after a reboot or a continuity in using it).
But we can consider that loading a memory snapshot inits the memory
first and then the snapshot will rewrite it with the saved datas.

Yes, I think reloading the snapshot will restore "dsp_core" structure, so it should be OK.

 > But I think code could be simplified a bit, there're some calls to
DSP_Init and DSP_UnInit when nDSPType is changed, but I wonder if it's

I think we must be careful here with this memory reset to 0 if we
disable / reenable the DSP (it must be considered as a first start to
have the DSP memory full clean)

I hope this makes sense to you.

When enabling/disabling DSP, I was thinking about just toggling bDspEnabled in another function.

I will give it a try to see if it doesn't break anything :)


Mail converted by MHonArc 2.6.19+