rx-proc-ghidra
rx-proc-ghidra copied to clipboard
Fix a few sleigh bugs
Hi !
First, let me thank you for the work you put into this ! I corrected a few details but overall it is very usable. I'm not sure you have the courage to get into some sleigh code 3 years after, but I figured I would do a PR for passersby that want to use this extension ;).
This PR contains:
- Keeping only one register (R1) for return values because Ghidra 10.1 does not load the extensions otherwise. There could be tuning for 8-bytes return values or floating point but for now I didn't stumble upon code using it.
- Changing the PUSHM and POPM ugly code by another ugly code :). The advantage is that the generated pcode does not have branches, and the Stack analyzer is much happier.
- Change "PC = xxx" to "call [xxx]" in some instructions. There are some left in the code but I'm not sure how it must be handled (syntactically).
- Add a call convention when all parameters are sent in the stack.
There are two more changes that I would like to add but I'm not really sure:
- Removing R15 from the default call convention because it is not used in my case. But I don't know if the "official" call convention uses it.
- A lot of arithmetic operations in the .sinc set "mode_mi = 4". This has the effect of only doing a 1-byte operation. But on most cases I saw, the operation is done on the full 4-bytes registers. This breaks several things, including SP tracking. I did a dirty fix by replacing with "mode_mi = 2" but I don't know if it will break other things.
Regards.
Hi all,
I want to thank the author @jamchamb for your tedious effort in creating this very useful processor module and @Tim--- for your patches.
@jamchamb , would you be willing to upload a license so your code can continue to be improved? PR #2 can be merged adding the Apache license if you so choose.
Thanks for considering this.
All the best, Gunther