Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion amnesia.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Amnesia:

def find_function_epilogue_bxlr(self, makecode=False):
'''
Find opcode bytes corresponding to BX LR.
Find opcode bytes corresponding to BX LR in thumb mode.
This is a common way to return from a function call.
Using the IDA API, convert these opcodes to code. This kicks off IDA analysis.
'''
Expand All @@ -49,6 +49,7 @@ def find_function_epilogue_bxlr(self, makecode=False):
if self.printflag:
print fmt_string % (ea, instructions[0], instructions[1])
if makecode:
idc.SetRegEx(ea, "T", 1, idc.SR_user)
idc.MakeCode(ea)
ea = ea + length

Expand Down Expand Up @@ -84,6 +85,7 @@ def find_pushpop_registers_thumb(self, makecode=False):
if self.printflag:
print fmt_string % (ea, instructions[0], instructions[1])
if makecode:
idc.SetRegEx(ea, "T", 1, idc.SR_user)
idc.MakeCode(ea)
ea = ea + length

Expand Down Expand Up @@ -117,6 +119,7 @@ def find_pushpop_registers_arm(self, makecode=False):
if self.printflag:
print fmt_string % ("POP ", ea, instructions[0], instructions[1])
if makecode:
idc.SetRegEx(ea, "T", 0, idc.SR_user)
idc.MakeCode(ea)

if not ida_bytes.isCode(ida_bytes.getFlags(ea)) and \
Expand All @@ -125,6 +128,7 @@ def find_pushpop_registers_arm(self, makecode=False):
if self.printflag:
print fmt_string % ("PUSH", ea, instructions[0], instructions[1])
if makecode:
idc.SetRegEx(ea, "T", 0, idc.SR_user)
idc.MakeCode(ea)
ea = ea + length

Expand Down
1 change: 1 addition & 0 deletions cortex_m_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def annotate_vector_table(self, vtoffset=0x0000000000):

if dword != 0:
# print "ea %08x = 0x%08x" % (ea, dword)
idc.SetRegEx(dword-1, "T", 1, idc.SR_user)
idc.MakeCode(dword-1)
idc.MakeFunction(dword-1)
# TODO fix the offsets created here
Expand Down