From dc9e958b0f8a9fb8eaa0f11acf75d6ed9bf3eb19 Mon Sep 17 00:00:00 2001 From: Ajax Date: Fri, 23 Dec 2016 15:12:36 +0100 Subject: AAS sem: avoid an ExprOp('-', a, b) --- miasm2/arch/x86/sem.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'miasm2') diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 5dc49efc..ced545be 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -2663,8 +2663,13 @@ def _tpl_aaa(ir, instr, op): cond |= af & i1 to_add = m2_expr.ExprInt(0x106, size=r_ax.size) - new_ax = m2_expr.ExprOp(op, r_ax, to_add) & m2_expr.ExprInt(0xff0f, - size=r_ax.size) + if op == "-": + # Avoid ExprOp("-", A, B), should be ExprOp("+", A, ExprOp("-", B)) + first_part = r_ax - to_add + else: + first_part = m2_expr.ExprOp(op, r_ax, to_add) + new_ax = first_part & m2_expr.ExprInt(0xff0f, + size=r_ax.size) # set AL e.append(m2_expr.ExprAff(r_ax, m2_expr.ExprCond(cond, new_ax, r_ax))) e.append(m2_expr.ExprAff(af, cond)) -- cgit 1.4.1