Skip to content

Instantly share code, notes, and snippets.

@jantore
Created July 9, 2017 18:05
Show Gist options
  • Save jantore/63c9fc4792a482c59c62c8bbfa99b07f to your computer and use it in GitHub Desktop.
Save jantore/63c9fc4792a482c59c62c8bbfa99b07f to your computer and use it in GitHub Desktop.
IDAPython script for finding functions in PPC code
import idc
# When setting up a new stack frame, r0 is used to store the old link
# register, and r1 is the stack pointer. Some compilers create the
# following function prologue:
# stwu r1, d(r1)
# mflr r0
prologue = "94 21 ? ? 7C 08 02 A6"
ea = MinEA()
while ea != idc.BADADDR:
ea = idc.FindBinary(ea + 4, 1, prologue, 16)
if not idc.GetFunctionName(ea):
idc.MakeFunction(ea)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment