Skip to content

Instantly share code, notes, and snippets.

@gitpraetorianlabs
Created June 1, 2016 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitpraetorianlabs/f1761a41f5997f2bd6b95c52af82df71 to your computer and use it in GitHub Desktop.
Save gitpraetorianlabs/f1761a41f5997f2bd6b95c52af82df71 to your computer and use it in GitHub Desktop.
=------------------------------=
| [0x4003f4] |
| (fcn) sym.pass_args_to_me 52 | // Disassembling the pass_args_to_me function
| addiu sp, sp, -8 | // Adjust stack address by 8 bytes (int = 4 bytes)
| sw fp, 4(sp) | // Save Frame pointer Address
| move fp, sp | // Move SP to FP (This is behavior is an indication that we're dealing with local variables)
| sw a0, 8(fp) | // Save int a into the frame pointer
| sw a1, 0xc(fp) | // Save int b into the frame pointer.
| lw v1, 8(fp) | // Load int a into $v1
| lw v0, 0xc(fp) | // Load int b into $v0
| addu v0, v1, v0 | // Add $v1 and $v0 and store the result into $v0
| move sp, fp | // Copy the frame pointer address into the stack pointer register ($sp)
| lw fp, 4(sp) | // Restore previously saved frame pointer
| addiu sp, sp, 8 | // Restore stack offset (8 bytes)
| jr ra | // Jump to the address loaded into $ra ($ra will point to the mov sp,fp instruction in main JAL = PC + 8 into $ra)
| nop |
=------------------------------=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment