beardypig / ghidra-emotionengine

Ghidra Processor for the Play Station 2's Emotion Engine MIPS based CPU
Apache License 2.0
198 stars 35 forks source link

Random number generator instructions are not injected (vrget, vrinit, vrnext, vrxor) #72

Open JayFoxRox opened 2 years ago

JayFoxRox commented 2 years ago

The instructions are declared, but don't seem to be injected:

https://github.com/beardypig/ghidra-emotionengine/blob/9e55ddaf47377b1fc5e0cea4f4abb4fb246cfda3/data/languages/vuupper.sinc#L39-L41 https://github.com/beardypig/ghidra-emotionengine/blob/9e55ddaf47377b1fc5e0cea4f4abb4fb246cfda3/data/languages/vuupper.sinc#L43-L43

Implementations can be found in PCSX2:

(In a function which uses these instructions, the decompiler also complains about "Low-level Error: Overlapping input varnodes", and I suspect it could be related)

JayFoxRox commented 2 years ago

I finally found a function which uses these instructions, but still decompiles correctly. Ghidra decompiler currently displays the instruction name like a function; that's acceptable and probably better than inlining what these instructions would do (which I proposed).

Feel free to close the issue if the current behaviour is intended.

astrelsky commented 2 years ago

I finally found a function which uses these instructions, but still decompiles correctly. Ghidra decompiler currently displays the instruction name like a function; that's acceptable and probably better than inlining what these instructions would do (which I proposed).

Feel free to close the issue if the current behaviour is intended.

There really isn't a good way to model hardware random number generation. This would be best left as it is.