chaoticgd / ghidra-emotionengine-reloaded

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

syscall 'function' in decompile window not showing syscall number #60

Closed RobertCochran closed 5 months ago

RobertCochran commented 5 months ago

The decompile window always shows the syscall as syscall(0), and not the actual syscall number. Based on various documentation I have found and the code I am working through, the EE uses v1 as the syscall number register, which is apparently a non-standard convention on MIPS.

chaoticgd commented 5 months ago

It looks like it shows the "code" field of the instruction in the decompilation instead of the syscall number, same as Ghidra's built-in MIPS implementation.

Usually syscalls are called through wrapper functions, so I imagine a good solution would be to give said functions appropriate names. Maybe that could be a feature in the future.

chaoticgd commented 5 months ago

I remember Ghidra added better syscall support a few years back, but I never looked much into it. Maybe I could see if that would help.

RobertCochran commented 5 months ago

Usually syscalls are called through wrapper functions, so I imagine a good solution would be to give said functions appropriate names. Maybe that could be a feature in the future.

In my very limited experience, this has usually been the case, except when it isn't; I have noticed in a couple places in the early bootstrap process of Ratchet 1 where there are direct syscalls. (the helper function in those cases got inlined away?)

chaoticgd commented 5 months ago

This is fixed now. Probably should've done it earlier, but now it's done.