Replies: 6 comments
-
Ok, I found a possible solution in GhidraDocs/languages/html/sleigh_definitions.html#idm140310875499872 (Section "4.3 Space Definitions):
Currently,
When I remove the
then the decompiler works as desired for the use case above. It does have the undesired side-effect that the disassembler now thinks that the program code belongs into the DATA memory, though. (BTW, the Sleigh documentation also mentions a |
Beta Was this translation helpful? Give feedback.
-
You can try using the following in the .pspec file, but I don't think this will quite help you, although it might make some other things work better.
By your program in the data space, do you mean when you load it? rel7addr: rel is op3to9signed [ rel = (op3to9signed + inst_next);] { |
Beta Was this translation helpful? Give feedback.
-
This was the problem I initially encountered - values that are passed to functions. |
Beta Was this translation helpful? Give feedback.
-
You can override the branching flow, but the decompiler currently only has a default space. I think the best thing is to set the default data space, and make sure any code references are caveated with correct [CODE] [DATA] access when the value is used as an address. I'm not sure what you mean by now your code references are going to the data space.Iis that when passed to parameters, or within the disassembly flow? |
Beta Was this translation helpful? Give feedback.
-
When I set the default DATA space, a .hex file is imported into this DATA space, even if I set the base address to |
Beta Was this translation helpful? Give feedback.
-
Regarding
I can only either use |
Beta Was this translation helpful? Give feedback.
-
This relates to ghidra 9.0.4 and the PIC processors, I'm specifically working with a PIC16F153xx.
An assembly sequence like this
is decompiled to
Inside the function
clearBuffer(byte *buffer,byte len)
the indirectly addressed parameter FSR0 is accessed e.g. via INDF0, like
CLRF INDF0
.Now here is my question:
The decompiled function call
shows an (unrelated) label "configureOscillator + 1" from the CODE segment.
However, PIC FSR0/FSR1/INDF0/INDF1/... instructions access the DATA segment.
Both segments use overlapping addresses (starting at 0x0000).
How can I make ghidra show labels from the DATA segment for this decompiler use case?
Beta Was this translation helpful? Give feedback.
All reactions