def call(ir, instr, a): e, a, dummy = mng_autoinc(a, None, 16) n = ExprId(ir.get_next_label(instr), 16) e.append(ExprAff(ExprMem(SP - ExprInt16(2), 16), n)) e.append(ExprAff(SP, SP - ExprInt16(2))) e.append(ExprAff(PC, a)) e.append(ExprAff(ir.IRDst, a)) return e, []
def call(ir, instr, a): e, a, dummy = mng_autoinc(a, None, 16) n = ExprId(ir.get_next_label(instr), 16) e.append(ExprAff(ExprMem(SP - ExprInt16(2), 16), n)) e.append(ExprAff(SP, SP - ExprInt16(2))) e.append(ExprAff(PC, a)) e.append(ExprAff(ir.IRDst, a)) return e, []
def add_condition_expr(ir, instr, cond, instr_ir): if cond == COND_AL: return instr_ir, [] if not cond in tab_cond: raise ValueError('unknown condition %r' % cond) cond = tab_cond[cond] lbl_next = ExprId(ir.get_next_label(instr), 32) lbl_do = ExprId(ir.gen_label(), 32) dst_cond = ExprCond(cond, lbl_do, lbl_next) assert(isinstance(instr_ir, list)) has_irdst = False for e in instr_ir: if e.dst == ir.IRDst: has_irdst = True break if not has_irdst: instr_ir.append(ExprAff(ir.IRDst, lbl_next)) e_do = irbloc(lbl_do.name, [instr_ir]) e = [ExprAff(ir.IRDst, dst_cond)] return e, [e_do]
def tbnz(arg1, arg2, arg3): bitmask = m2_expr.ExprInt(1, arg1.size) << arg2 dst = arg3 if arg1 & bitmask else m2_expr.ExprId( ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def b_ne(arg1): dst = m2_expr.ExprId(ir.get_next_label(instr), 64) if zf else arg1 PC = dst ir.IRDst = dst
def cbz(arg1, arg2): dst = m2_expr.ExprId(ir.get_next_label(instr), 64) if arg1 else arg2 PC = dst ir.IRDst = dst
def cbnz(arg1, arg2): dst = arg2 if arg1 else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def tbz(arg1, arg2, arg3): bitmask = m2_expr.ExprInt_from(arg1, 1) << arg2 dst = m2_expr.ExprId( ir.get_next_label(instr), 64) if arg1 & bitmask else arg3 PC = dst ir.IRDst = dst
def jge(ir, instr, a): n = ExprId(ir.get_next_label(instr), 16) e = [] e.append(ExprAff(PC, ExprCond(nf ^ of, n, a))) e.append(ExprAff(ir.IRDst, ExprCond(nf ^ of, n, a))) return e, []
def b_lt(arg1): cond = cond2expr['LT'] dst = arg1 if cond else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def cbnz(ir, instr, a, b): e = [] lbl_next = ExprId(ir.get_next_label(instr), 32) e.append(ir.IRDst, ExprCond(a, b, lbl_next)) return e
def b_ne(arg1): dst = m2_expr.ExprId(ir.get_next_label(instr), 64) if zf else arg1 PC = dst ir.IRDst = dst
def b_eq(arg1): dst = arg1 if zf else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def tbnz(arg1, arg2, arg3): bitmask = m2_expr.ExprInt(1, arg1.size) << arg2 dst = arg3 if arg1 & bitmask else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def cbnz(arg1, arg2): dst = arg2 if arg1 else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def cbz(arg1, arg2): dst = m2_expr.ExprId(ir.get_next_label(instr), 64) if arg1 else arg2 PC = dst ir.IRDst = dst
def b_eq(arg1): dst = arg1 if zf else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def jc(ir, instr, a): n = ExprId(ir.get_next_label(instr), 16) e = [] e.append(ExprAff(PC, ExprCond(cf, a, n))) e.append(ExprAff(ir.IRDst, ExprCond(cf, a, n))) return e, []
def b_lt(arg1): cond = cond2expr['LT'] dst = arg1 if cond else m2_expr.ExprId(ir.get_next_label(instr), 64) PC = dst ir.IRDst = dst
def jc(ir, instr, a): n = ExprId(ir.get_next_label(instr), 16) e = [] e.append(ExprAff(PC, ExprCond(cf, a, n))) e.append(ExprAff(ir.IRDst, ExprCond(cf, a, n))) return e, []
def tbz(arg1, arg2, arg3): bitmask = m2_expr.ExprInt_from(arg1, 1) << arg2 dst = m2_expr.ExprId(ir.get_next_label(instr), 64) if arg1 & bitmask else arg3 PC = dst ir.IRDst = dst
def jge(ir, instr, a): n = ExprId(ir.get_next_label(instr), 16) e = [] e.append(ExprAff(PC, ExprCond(nf ^ of, n, a))) e.append(ExprAff(ir.IRDst, ExprCond(nf ^ of, n, a))) return e, []