about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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])]