Converting addresses relative to register to fixed addresses #7000
Replies: 2 comments
-
|
The weird bit is that the Why is this not coming across to the decompilation listing, though? The value of and the value assigned to which should point to one of the strings defined in the binary I'm reversing. How do I make P-Code do these calculations for me so that I see the actual string in the decompilation listing and not the relative address? |
Beta Was this translation helpful? Give feedback.
-
|
The answer in general is to define the value of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a processor architecture (AndeStar / NDS32) that has a bunch of instructions operating off of a register.
Say the register is
GPand the instruction areLWI.GP. The instruction takes an offset and loads a value from GP + offset.It's described thusly
Here's an example disassembly
and the corresponding decompilation
Note how Ghidra creates a local
unaff_gpvariable, to be used asunaff_gp + -0x305c. This is useless and should be improved by adding the offset to the contents ofGPand using that calculated address instead.The address can be calculated by tracking modifications to the
GPregister, e.g. the following stores0x450into the high 16-bit portion of theGPregister (i.e.0x450 << 12) and then adds0x428to itIs there a way to keep track of modifications to the
GPregister in Sleigh and use fixed addresses inLWI.GPas opposed to relative ones?Beta Was this translation helpful? Give feedback.
All reactions