about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-09-11 11:31:07 +0200
committerChristian Krinitsin <mail@krinitsin.com>2025-09-11 12:41:50 +0200
commit2829dab66e3ee7bcd4d8c0cdeda8dfcb9fde4cae (patch)
tree89c1ed41a32ec71097bc4d4f71326ee6cb84f1b6
parentac309492c91dd6022e926ba32ac556c2ecedabbb (diff)
downloadmiasm-2829dab66e3ee7bcd4d8c0cdeda8dfcb9fde4cae.tar.gz
miasm-2829dab66e3ee7bcd4d8c0cdeda8dfcb9fde4cae.zip
Fix carry flag of BLSI instruction
-rw-r--r--miasm/arch/x86/sem.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/miasm/arch/x86/sem.py b/miasm/arch/x86/sem.py
index cb638bc7..15db7424 100644
--- a/miasm/arch/x86/sem.py
+++ b/miasm/arch/x86/sem.py
@@ -4379,10 +4379,9 @@ def blsi(_, instr, dst, src):
     e += update_flag_nf(result)
     e.append(m2_expr.ExprAssign(of, m2_expr.ExprInt(0, of.size)))
 
-    if src == 0:
-        e.append(m2_expr.ExprAssign(cf, m2_expr.ExprInt(0, cf.size)))
-    else:
-        e.append(m2_expr.ExprAssign(cf, m2_expr.ExprInt(1, cf.size)))
+    e.append(m2_expr.ExprAssign(cf, m2_expr.ExprCond(src,
+                                                     m2_expr.ExprInt(1, 1),
+                                                     m2_expr.ExprInt(0, 1))))
 
     e.append(m2_expr.ExprAssign(dst, result))
     return e, []