about summary refs log tree commit diff stats
path: root/miasm2
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2')
-rw-r--r--miasm2/arch/x86/sem.py13
-rw-r--r--miasm2/expression/expression_helper.py10
2 files changed, 11 insertions, 12 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 93c4910a..9f438b71 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -21,7 +21,6 @@ import miasm2.expression.expression as m2_expr
 from miasm2.expression.simplifications import expr_simp
 from miasm2.arch.x86.regs import *
 from miasm2.arch.x86.arch import mn_x86, repeat_mn, replace_regs
-from miasm2.expression.expression_helper import expr_cmps, expr_cmpu
 from miasm2.ir.ir import IntermediateRepresentation, IRBlock, AssignBlock
 from miasm2.core.sembuilder import SemBuilder
 from miasm2.jitter.csts import EXCEPT_DIV_BY_ZERO, EXCEPT_ILLEGAL_INSN, \
@@ -2741,11 +2740,11 @@ def daa(_, instr):
     e = []
     r_al = mRAX[instr.mode][:8]
 
-    cond1 = expr_cmpu(r_al[:4], m2_expr.ExprInt(0x9, 4)) | af
+    cond1 = m2_expr.expr_is_unsigned_greater(r_al[:4], m2_expr.ExprInt(0x9, 4)) | af
     e.append(m2_expr.ExprAff(af, cond1))
 
-    cond2 = expr_cmpu(m2_expr.ExprInt(6, 8), r_al)
-    cond3 = expr_cmpu(r_al, m2_expr.ExprInt(0x99, 8)) | cf
+    cond2 = m2_expr.expr_is_unsigned_greater(m2_expr.ExprInt(6, 8), r_al)
+    cond3 = m2_expr.expr_is_unsigned_greater(r_al, m2_expr.ExprInt(0x99, 8)) | cf
 
     cf_c1 = m2_expr.ExprCond(cond1,
                              cf | (cond2),
@@ -2771,11 +2770,11 @@ def das(_, instr):
     e = []
     r_al = mRAX[instr.mode][:8]
 
-    cond1 = expr_cmpu(r_al[:4], m2_expr.ExprInt(0x9, 4)) | af
+    cond1 = m2_expr.expr_is_unsigned_greater(r_al[:4], m2_expr.ExprInt(0x9, 4)) | af
     e.append(m2_expr.ExprAff(af, cond1))
 
-    cond2 = expr_cmpu(m2_expr.ExprInt(6, 8), r_al)
-    cond3 = expr_cmpu(r_al, m2_expr.ExprInt(0x99, 8)) | cf
+    cond2 = m2_expr.expr_is_unsigned_greater(m2_expr.ExprInt(6, 8), r_al)
+    cond3 = m2_expr.expr_is_unsigned_greater(r_al, m2_expr.ExprInt(0x99, 8)) | cf
 
     cf_c1 = m2_expr.ExprCond(cond1,
                              cf | (cond2),
diff --git a/miasm2/expression/expression_helper.py b/miasm2/expression/expression_helper.py
index 1e718faa..722d169d 100644
--- a/miasm2/expression/expression_helper.py
+++ b/miasm2/expression/expression_helper.py
@@ -21,6 +21,7 @@ import itertools
 import collections
 import random
 import string
+import warnings
 
 import miasm2.expression.expression as m2_expr
 
@@ -468,16 +469,14 @@ class ExprRandom(object):
 
         return got
 
-def _expr_cmp_gen(arg1, arg2):
-    return (arg2 - arg1) ^ ((arg2 ^ arg1) & ((arg2 - arg1) ^ arg2))
-
 def expr_cmpu(arg1, arg2):
     """
     Returns a one bit long Expression:
     * 1 if @arg1 is strictly greater than @arg2 (unsigned)
     * 0 otherwise.
     """
-    return (_expr_cmp_gen(arg1, arg2) ^ arg2 ^ arg1).msb()
+    warnings.warn('DEPRECATION WARNING: use "expr_is_unsigned_greater" instead"')
+    return m2_expr.expr_is_unsigned_greater(arg1, arg2)
 
 def expr_cmps(arg1, arg2):
     """
@@ -485,7 +484,8 @@ def expr_cmps(arg1, arg2):
     * 1 if @arg1 is strictly greater than @arg2 (signed)
     * 0 otherwise.
     """
-    return _expr_cmp_gen(arg1, arg2).msb()
+    warnings.warn('DEPRECATION WARNING: use "expr_is_signed_greater" instead"')
+    return m2_expr.expr_is_signed_greater(arg1, arg2)
 
 
 class CondConstraint(object):