diff options
| author | Ajax <commial@gmail.com> | 2016-12-23 15:12:36 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2016-12-23 15:12:36 +0100 |
| commit | dc9e958b0f8a9fb8eaa0f11acf75d6ed9bf3eb19 (patch) | |
| tree | db0039203e911606f668029117a236f94f5ab86e | |
| parent | 50661f59da48540a6d87ab5f42c41e761a9c11d8 (diff) | |
| download | miasm-dc9e958b0f8a9fb8eaa0f11acf75d6ed9bf3eb19.tar.gz miasm-dc9e958b0f8a9fb8eaa0f11acf75d6ed9bf3eb19.zip | |
AAS sem: avoid an ExprOp('-', a, b)
| -rw-r--r-- | miasm2/arch/x86/sem.py | 9 |
1 files changed, 7 insertions, 2 deletions
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)) |