about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorajax <devnull@localhost>2014-06-14 19:15:37 +0200
committerajax <devnull@localhost>2014-06-14 19:15:37 +0200
commite6f8c26e28be9ebb279866de39b0d88da10e606d (patch)
treea91e5c724db48d4fc0d0fdae826e1c982a22f7e4
parentf406319ae903194554437d292a590bb55c2d6853 (diff)
downloadmiasm-e6f8c26e28be9ebb279866de39b0d88da10e606d.tar.gz
miasm-e6f8c26e28be9ebb279866de39b0d88da10e606d.zip
x86 SEM: Fix LOOPNE, LOOPE. Use ExprCond instead of ExprOp('==')
-rw-r--r--miasm2/arch/x86/sem.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index f85a6bcf..8dfd6883 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -1282,18 +1282,18 @@ def loopne(ir, instr, dst):
 
     n = ExprId(ir.get_next_label(instr), instr.mode)
 
-    c = ExprOp('==',
-               mRCX[instr.mode][:s] - ExprInt_fromsize(s, 1),
-               ExprInt_fromsize(s, 0)) ^ ExprInt1(1)
+    c = ExprCond(mRCX[instr.mode][:s] - ExprInt_fromsize(s, 1),
+                 ExprInt1(1),
+                 ExprInt1(0))
     c &= zf ^ ExprInt1(1)
 
     e.append(ExprAff(myecx, myecx - ExprInt_from(myecx, 1)))
     e.append(ExprAff(meip, ExprCond(c, dst, n).zeroExtend(instr.mode)))
 
     # for dst, ecx has been modified!
-    c = ExprOp('==',
-               mRCX[instr.mode][:s],
-               ExprInt_fromsize(s, 0)) ^ ExprInt1(1)
+    c = ExprCond(mRCX[instr.mode][:s],
+                 ExprInt1(1),
+                 ExprInt1(0))
     c &= zf ^ ExprInt1(1)
     dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
     return dst_o, e, []
@@ -1307,18 +1307,18 @@ def loope(ir, instr, dst):
     myecx = mRCX[instr.mode][:admode]
 
     n = ExprId(ir.get_next_label(instr), instr.mode)
-    c = ExprOp('==',
-               mRCX[instr.mode][:s] - ExprInt_fromsize(s, 1),
-               ExprInt_fromsize(s, 0)) ^ ExprInt1(1)
+    c = ExprCond(mRCX[instr.mode][:s] - ExprInt_fromsize(s, 1),
+                 ExprInt1(1),
+                 ExprInt1(0))
     c &= zf
     e.append(ExprAff(myecx, myecx - ExprInt_from(myecx, 1)))
     dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
     e.append(ExprAff(meip, dst_o))
 
     # for dst, ecx has been modified!
-    c = ExprOp('==',
-               mRCX[instr.mode][:s],
-               ExprInt_fromsize(s, 0)) ^ ExprInt1(1)
+    c = ExprCond(mRCX[instr.mode][:s],
+                 ExprInt1(1),
+                 ExprInt1(0))
     c &= zf
     dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
     return dst_o, e, []