Skip to content
joelpx edited this page Nov 27, 2016 · 4 revisions

Read a MIPS binary

The value of the $gp register is not computed automatically, you must set it first. The analyzer is "disabled" when you open a MIPS file.

Example :

$ plasma mips_elf_file -i

Go at the entry point in visual mode and create code with c.

>> v EP
press c
press I
>> dump EP
0x4002b0: move $zero, $ra
0x4002b4: bal sub_4002bc
0x4002b8: nop 

; ---------------------------------------------------------------------
; SUBROUTINE
; ---------------------------------------------------------------------
sub_4002bc:   __noreturn__
int        arg_0     = 0x0

0x4002bc: lui $gp, 0x19
0x4002c0: !li $gp, 0x189c24
0x4002c4: addu $gp, $gp, $ra
0x4002c8: move $ra, $zero
...

We can see that in the function sub_4002bc, $gp is set to 0x189c24 then $ra is added. Here $ra is equal to 0x4002bc, and $gp = 0x189c24 + 0x4002bc = 0x589ee0

>> mips_set_gp 0x589ee0

Then we tell explicitly to start the analysis.

>> push_analyze_symbols
Clone this wiki locally