From 89f6bfbae7ea6779d9424d8b1fd84843bf8ee23f Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Thu, 11 Sep 2025 11:31:07 +0200 Subject: Fix carry flag of BLSI instruction --- miasm/arch/x86/sem.py | 7 +++---- 1 file 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, [] -- cgit 1.4.1