Пример #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)
Пример #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])
Пример #3
0
 def __init__(self):
     Architecture.__init__(self, ppc_jumps, ppc_calls)
Пример #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))
Пример #5
0
 def __init__(self):
     Architecture.__init__(self, mips_jumps, mips_calls)
     self.jumpRegexp = re.compile("(?:(" + REGISTER_REGEXP + "),)+" + "(" + ADDRESS_REGEXP + ")")
Пример #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])
Пример #7
0
 def __init__(self):
     Architecture.__init__(self, ppc_jumps, ppc_calls)
Пример #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))
Пример #9
0
 def __init__(self):
     Architecture.__init__(self, mips_jumps, mips_calls)
     self.jumpRegexp = re.compile("(?:(" + REGISTER_REGEXP + "),)+" + "(" + ADDRESS_REGEXP + ")");