DSPLLE: Add assertion for bad DMA alignment #11480
Merged
+9
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
This caused me a lot of trouble, as DSPSpy was breaking when compiled with
-O0. It ended up being the case thatdsp_codewas placed at0x800ba400at-O2,0x800ba320at-O1, and0x800bb3eeat-O0. I don't know if the alignment at-O1and higher was just a coincidence or not.The symptom of misaligned code was either no mail at all from the DSP (instead showing the DSP ROM's
0x8071feedmail) or the appearance of an exception occuring (instead showing dspspy exception handler's0x8bad0001mail). I also sometimes got hangs. My guess is that it just rounded the address up or down, but I'm not 100% sure of this and don't want to investigate it currently since I'm busy investigating edge cases that things actually rely on (somewhat). This behavior can be investigated further later.DSPTool forced 64 byte alignment starting early on (f6474b9), but that was removed fairly quickly (6e61c32). In comparison, libogc's gcdsptool has had 32 byte alignment from early on too (2cea6d99ad518c963e24c3e28834473ff5312e69), and still does (although I'm not 100% sure whether that still applies, as they use
bin2sinstead of generating a header, and that change did result in the length not always being a multiple of 32). The libogc documentation says that pointers "have" to be aligned while lengths "should" be a multiple of 32, for what it's worth.