about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-05 16:09:55 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-05 16:09:55 +0200
commit75399c706160678a724d2c6f9d288f62b29f494d (patch)
tree292f22b07d06497e203428afcd886631a84070bd
parentc3463980ca9a3ac261cc52f9191a86811159d3c7 (diff)
downloadmiasm-75399c706160678a724d2c6f9d288f62b29f494d.tar.gz
miasm-75399c706160678a724d2c6f9d288f62b29f494d.zip
x86 sem: fix sar/shr multiple irdst
-rw-r--r--example/asm_x86.py8
-rw-r--r--miasm2/arch/x86/sem.py6
2 files changed, 12 insertions, 2 deletions
diff --git a/example/asm_x86.py b/example/asm_x86.py
index 92d5029a..b9f2cc5b 100644
--- a/example/asm_x86.py
+++ b/example/asm_x86.py
@@ -60,6 +60,14 @@ mystr:
    NOP
    NOP
    CMOVZ EAX, EBX
+   ; test shr
+   NOP
+   SHR EAX, 1
+   NOP
+   NOP
+   SHR EAX, CL
+   NOP
+
    MOV  ESP, EBP
    POP  EBP
    RET
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 5dd1168a..c304def6 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -392,7 +392,6 @@ def sar(ir, instr, a, b):
         ExprAff(cf, new_cf),
         ExprAff(of, ExprInt_from(of, 0)),
         ExprAff(a, c),
-        ExprAff(ir.IRDst, lbl_skip)
     ]
 
     e_do += update_flag_znp(c)
@@ -404,6 +403,8 @@ def sar(ir, instr, a, b):
         else:
             return [], []
 
+    e_do.append(ExprAff(ir.IRDst, lbl_skip))
+
     e = []
     e.append(ExprAff(ir.IRDst, ExprCond(shifter, lbl_do, lbl_skip)))
     return e, [irbloc(lbl_do.name, [e_do])]
@@ -423,7 +424,6 @@ def shr(ir, instr, a, b):
         ExprAff(cf, new_cf),
         ExprAff(of, ExprInt_from(of, 0)),
         ExprAff(a, c),
-        ExprAff(ir.IRDst, lbl_skip)
     ]
 
     e_do += update_flag_znp(c)
@@ -435,6 +435,8 @@ def shr(ir, instr, a, b):
         else:
             return [], []
 
+    e_do.append(ExprAff(ir.IRDst, lbl_skip))
+
     e = []
     e.append(ExprAff(ir.IRDst, ExprCond(shifter, lbl_do, lbl_skip)))
     return e, [irbloc(lbl_do.name, [e_do])]