Looking for advice to implement a loop in Sleigh #7292
-
I'm trying to improve RH850 support, in particular PUSHSP / POPSP. These opcodes used to put (get) multiple registers in the stack in a time. Specification says: But as I know, getting the register address in Sleigh not the best approach, sometimes Ghidra produses weird decompilation in this case. Any ideas, how to handle it? Make a context register 'SPcopy' and load/save regsters in relation to it (it will require 32 subtables both for pop and push) ? Or there is some easier way? Full specification: RH850G4MH User’s Manual: Software pages 135, 140 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I think if you have a context value that can track the current register and compare it to the end of the list, you should be able to build it up. See buildVldmSdList in |
Beta Was this translation helpful? Give feedback.
-
Thanks! |
Beta Was this translation helpful? Give feedback.
-
Looks like it works: thanks one more time! |
Beta Was this translation helpful? Give feedback.
I think if you have a context value that can track the current register and compare it to the end of the list, you should be able to build it up.
See buildVldmSdList in
ARMneon.sinc
. It uses a recursive sub-constructor and a 32-element subtable that is used for both push/pop (SReg
) that should do exactly what you need here.