Converting addresses relative to register to fixed addresses #7000
Unanswered
joelreymont
asked this question in
Q&A
Replies: 1 comment
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a processor architecture (AndeStar / NDS32) that has a bunch of instructions operating off of a register.
Say the register is
GP
and 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_gp
variable, to be used asunaff_gp + -0x305c
. This is useless and should be improved by adding the offset to the contents ofGP
and using that calculated address instead.The address can be calculated by tracking modifications to the
GP
register, e.g. the following stores0x450
into the high 16-bit portion of theGP
register (i.e.0x450 << 12
) and then adds0x428
to itIs there a way to keep track of modifications to the
GP
register in Sleigh and use fixed addresses inLWI.GP
as opposed to relative ones?Beta Was this translation helpful? Give feedback.
All reactions