def getJumpDestination(self, address, insn, args): #example: #address = 84L #insn = 'brge' #args = '.+6 ' if insn in ['sbrc', 'sbrs']: #skip instructions #TODO XXX: this depends on the size of the instruction skipped! # (can be 16 or 32 bits (jmp, call, lds, sts)) return long(address + 4) if args[0] == '.': #relative jump offset = long(args[1:]) return long(address + offset + 2) else: #absolute jump? return Architecture.getJumpDestination(self, address, insn, args)
def getJumpDestination(self, address, insn, args): r = args.split(",") if len(r) == 1: return Architecture.getJumpDestination(self, address, insn, args) return Architecture.getJumpDestination(self, address, insn, r[-1])
def __init__(self): Architecture.__init__(self, ppc_jumps, ppc_calls)
def getJumpDestination(self, address, insn, args): r = self.jumpRegexp.match(args) if r == None: return Architecture.getJumpDestination(self, address, insn, args) return Architecture.getJumpDestination(self, address, insn, r.group(2))
def __init__(self): Architecture.__init__(self, mips_jumps, mips_calls) self.jumpRegexp = re.compile("(?:(" + REGISTER_REGEXP + "),)+" + "(" + ADDRESS_REGEXP + ")")
def __init__(self): Architecture.__init__(self, mips_jumps, mips_calls) self.jumpRegexp = re.compile("(?:(" + REGISTER_REGEXP + "),)+" + "(" + ADDRESS_REGEXP + ")");