about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-06-20 13:18:11 +0200
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-10-09 15:26:04 +0000
commita1062578019024e70b51752e29dcd18eb6672a99 (patch)
tree2673f5d7ebd5a688a010da5a2bc3f06788ee448e
parent13f9661aabe44ea4e4f147c32a344a1db128ab16 (diff)
downloadfocaccia-miasm-a1062578019024e70b51752e29dcd18eb6672a99.tar.gz
focaccia-miasm-a1062578019024e70b51752e29dcd18eb6672a99.zip
Add support for BLSI instruction for x86
-rw-r--r--miasm/arch/x86/sem.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/miasm/arch/x86/sem.py b/miasm/arch/x86/sem.py
index 81e45e7e..fb5ee7d5 100644
--- a/miasm/arch/x86/sem.py
+++ b/miasm/arch/x86/sem.py
@@ -4368,6 +4368,23 @@ def ucomisd(_, instr, src1, src2):
 
     return e, []
 
+def blsi(_, instr, dst, src):
+    e = []
+
+    arg1 = m2_expr.ExprInt(0, src.size)
+    result = arg1 - src
+
+    e += update_flag_zf(result)
+    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(dst, result))
+    return e, []
 
 def pshufb(_, instr, dst, src):
     e = []
@@ -5499,6 +5516,9 @@ mnemo_func = {'mov': mov,
               "ucomiss": ucomiss,
               "ucomisd": ucomisd,
 
+              # BMI operations
+              "blsi": blsi,
+
               #
               # MMX/AVX/SSE operations