Example #1
0
    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)
Example #2
0
 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])
Example #3
0
 def __init__(self):
     Architecture.__init__(self, ppc_jumps, ppc_calls)
Example #4
0
 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))
Example #5
0
 def __init__(self):
     Architecture.__init__(self, mips_jumps, mips_calls)
     self.jumpRegexp = re.compile("(?:(" + REGISTER_REGEXP + "),)+" + "(" + ADDRESS_REGEXP + ")")
Example #6
0
 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])
Example #7
0
 def __init__(self):
     Architecture.__init__(self, ppc_jumps, ppc_calls)
Example #8
0
 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))
Example #9
0
 def __init__(self):
     Architecture.__init__(self, mips_jumps, mips_calls)
     self.jumpRegexp = re.compile("(?:(" + REGISTER_REGEXP + "),)+" + "(" + ADDRESS_REGEXP + ")");