diff --git a/amnesia.py b/amnesia.py index b7de5eb..8f6764f 100644 --- a/amnesia.py +++ b/amnesia.py @@ -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. ''' @@ -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 @@ -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 @@ -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 \ @@ -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 diff --git a/cortex_m_firmware.py b/cortex_m_firmware.py index a34dd5d..fa5012e 100644 --- a/cortex_m_firmware.py +++ b/cortex_m_firmware.py @@ -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