chaoticgd / ghidra-emotionengine-reloaded

An extension for Ghidra that adds support for the PlayStation 2.
Apache License 2.0
118 stars 11 forks source link

Some VU instructions not recognized? #38

Closed Mc-muffin closed 9 months ago

Mc-muffin commented 9 months ago

When loading Kingdom Hearts (SLPS_25105) there are some VU macro mode opcodes that aren't recognized, disassembling stops and a bookmark is added with the text Error [Bad Instruction]: Unable to resolve constructor at (address) low from (other address) for example: image according to ee-objdump the unrecognized instruction is vsqrt Q,vf5x (bytes BD 03 25 4A)

Here's the decoding of other problematic instructions with ee-objdump as a sample: vaddr (hex) bytes (little endian) ee-objdump output
1bb110 4b8d29ff vclipw.xy vf5,vf13w
1bb114 4b8d31ff vclipw.xy vf6,vf13w
1bb118 4b8e29ff vclipw.xy vf5,vf14w
1bb11c 4b8e31ff vclipw.xy vf6,vf14w
1bb13c 4a4c29ff vclipw.z vf5,vf12w
1bb140 4a4c31ff vclipw.z vf6,vf12w
chaoticgd commented 9 months ago

I think I've fixed it. The problem with the vclip instruction was my SLEIGH code was assuming it was always a "xyz" variant (the manual implies this), and the problem with the vsqrt instruction was it was checking that unused fields were always zero. I've gone through all the instructions for which these problems are relevant and made the disassembly much more permissive.

Could you test the latest unstable build for me before I push out a new version? https://github.com/chaoticgd/ghidra-emotionengine-reloaded/releases/download/unstable/ghidra_10.3.3_PUBLIC_20230915_ghidra-emotionengine-reloaded.zip

Mc-muffin commented 9 months ago

Had a power outage today, but now I can confirm the new build correctly disassembles the problematic code sections now, thanks for the quick actions on your part :)

chaoticgd commented 9 months ago

Okay great, I've put out a new release.