Beispiel #1
0
    def post_add_bloc(self, block, ir_blocks):
        IntermediateRepresentation.post_add_bloc(self, block, ir_blocks)
        new_irblocks = []
        for irb in ir_blocks:
            pc_val = None
            lr_val = None
            for assignblk in irb.irs:
                pc_val = assignblk.get(self.arch.regs.PC, pc_val)
                lr_val = assignblk.get(self.arch.regs.RA, lr_val)

            if pc_val is None or lr_val is None:
                new_irblocks.append(irb)
                continue
            if not expr_is_int_or_label(lr_val):
                new_irblocks.append(irb)
                continue
            if expr_is_label(lr_val):
                lr_val = ExprInt(lr_val.name.offset, 32)

            instr = block.lines[-2]
            if lr_val.arg != instr.offset + 8:
                raise ValueError("Wrong arg")

            # CALL
            lbl = block.get_next()
            new_lbl = self.gen_label()
            irs = self.call_effects(pc_val, instr)
            irs.append(AssignBlock([ExprAff(self.IRDst,
                                            ExprId(lbl, size=self.pc.size))],
                                   instr))
            new_irblocks.append(IRBlock(new_lbl, irs))
            new_irblocks.append(irb.set_dst(ExprId(new_lbl, size=self.pc.size)))
        return new_irblocks
Beispiel #2
0
 def __init__(self, loc_db=None):
     IntermediateRepresentation.__init__(self, mn_msp430, None, loc_db)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 16)
     self.addrsize = 16
Beispiel #3
0
 def __init__(self, loc_db=None):
     self.addrsize = 32
     IntermediateRepresentation.__init__(self, mn_mips32, 'b', loc_db)
     self.pc = mn_mips32.getpc()
     self.sp = mn_mips32.getsp()
     self.IRDst = m2_expr.ExprId('IRDst', 32)
Beispiel #4
0
 def __init__(self, loc_db=None):
     IntermediateRepresentation.__init__(self, mn_mep, "l", loc_db)
     self.pc = mn_mep.getpc()
     self.sp = mn_mep.getsp()
     self.IRDst = ExprId("IRDst", 32)
Beispiel #5
0
 def __init__(self, loc_db=None):
     IntermediateRepresentation.__init__(self, mn_armt, "b", loc_db)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 32)
     self.addrsize = 32
Beispiel #6
0
 def __init__(self, loc_db=None):
     IntermediateRepresentation.__init__(self, mn_aarch64, "b", loc_db)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 64)
Beispiel #7
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_aarch64, "b", symbol_pool)
     self.pc = PC
     self.sp = SP
     self.IRDst = m2_expr.ExprId('IRDst', 64)
Beispiel #8
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_armt, "b", symbol_pool)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 32)
Beispiel #9
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_armt, "l", symbol_pool)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 32)
     self.addrsize = 32
Beispiel #10
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_mips32, 'b', symbol_pool)
     self.pc = mn_mips32.getpc()
     self.sp = mn_mips32.getsp()
     self.IRDst = m2_expr.ExprId('IRDst', 32)
Beispiel #11
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_msp430, None, symbol_pool)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 16)
Beispiel #12
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_mips32, 'b', symbol_pool)
     self.pc = mn_mips32.getpc()
     self.sp = mn_mips32.getsp()
     self.IRDst = m2_expr.ExprId('IRDst', 32)
Beispiel #13
0
 def __init__(self, loc_db=None):
     IntermediateRepresentation.__init__(self, mn_aarch64, "l", loc_db)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 64)
     self.addrsize = 64
Beispiel #14
0
 def __init__(self, loc_db=None):
     IntermediateRepresentation.__init__(self, mn_armt, "b", loc_db)
     self.pc = PC
     self.sp = SP
     self.IRDst = ExprId('IRDst', 32)
     self.addrsize = 32
Beispiel #15
0
 def __init__(self, symbol_pool=None):
     IntermediateRepresentation.__init__(self, mn_aarch64, "b", symbol_pool)
     self.pc = PC
     self.sp = SP
     self.IRDst = m2_expr.ExprId('IRDst', 64)