beardypig / ghidra-emotionengine

Ghidra Processor for the Play Station 2's Emotion Engine MIPS based CPU
Apache License 2.0
198 stars 35 forks source link

Can't jump to location of gp register #56

Closed Tupelov closed 3 years ago

Tupelov commented 3 years ago

image

astrelsky commented 3 years ago

It's on the heap, there won't be anything there. If you wan't you can create an uninitialized memory block from the Ghidra user interface in the memory map window (Window->Memory Map). After creating it you should be able to go to the address.

Tupelov commented 3 years ago

Here I manually added a reference. image I dont think it would make sense for the heap to be referenced by gp since it's usually put in the middle of the data like so image The heap is usually started at the end of bss image I don't mean any offense I just wanna clear misinformation :)

astrelsky commented 3 years ago

Oh. I misunderstood the issue when I saw the symbol in the output.

Have you run the constant propagation analyzer? If the magic gp symbol (I forget the actual name) is defined then it should automatically be taken care of during analysis.

I actually thought that gp was the start of the heap. I've never reversed anything that actually used it so I just learned something new.

Tupelov commented 3 years ago

Yeah its used so that you can load address from memory in a single instruction as long as they are at a offset of−32,768 to 32,767 from gp using something like sw,lw etc. rather than use lui + addiu so it's pretty important when it comes to commercial stuff.

I can't actually find Constant propagation analysis inside my analyzer window and it seems that it wouldn't help in this situation as it seems to analyze pointing to addresses with multiple instructions and gp accesses are usually only done with one

Tupelov commented 3 years ago

Ok it seems like my eyes weren't working I found the option ._. Looks like it fixed it although there are still some lieing around so I'll have to check more

Tupelov commented 3 years ago

I'll close this issue but for reference "MIPS-R5900 Constant Reference Analyzer" is what fixed it. Thanks for the help :)

astrelsky commented 3 years ago

I'll close this issue but for reference "MIPS-R5900 Constant Reference Analyzer" is what fixed it. Thanks for the help :)

This analyzer should be enabled by default. Was this not the case?

Tupelov commented 3 years ago

Looks like it is on by default when I look at it. I'm not sure why it didn't work when I analyzed the file at the start. I've been having this issue over several versions of the extension (with different projects).