diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-09-11 14:54:44 +0200 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-09-11 14:54:44 +0200 |
| commit | 9c833bef62674024a96dee0b2ad94e2eaf75471e (patch) | |
| tree | 1717c5fe18a450feabac68254537f39514c781db | |
| parent | 2829dab66e3ee7bcd4d8c0cdeda8dfcb9fde4cae (diff) | |
| download | miasm-9c833bef62674024a96dee0b2ad94e2eaf75471e.tar.gz miasm-9c833bef62674024a96dee0b2ad94e2eaf75471e.zip | |
Add BLSMSK instruction
| -rw-r--r-- | miasm/arch/x86/arch.py | 1 | ||||
| -rw-r--r-- | miasm/arch/x86/sem.py | 18 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 3 |
3 files changed, 22 insertions, 0 deletions
diff --git a/miasm/arch/x86/arch.py b/miasm/arch/x86/arch.py index 4a8af629..e63ce6cf 100644 --- a/miasm/arch/x86/arch.py +++ b/miasm/arch/x86/arch.py @@ -3786,6 +3786,7 @@ addop("fincstp", [bs8(0xd9), bs8(0xf7)]) addop("blsi", [pref_0f38, bs8(0xf3), vex_reg] + rmmod(bs("011"), rm_arg), [vex_reg, rm_arg]) addop("andn", [pref_0f38, bs8(0xf2), vex_reg] + rmmod(rmreg, rm_arg), [rmreg, vex_reg, rm_arg]) addop("bextr", [pref_0f38, bs8(0xf7), vex_reg] + rmmod(rmreg, rm_arg), [rmreg, rm_arg, vex_reg]) +addop("blsmsk", [pref_0f38, bs8(0xf3), vex_reg] + rmmod(bs("010"), rm_arg), [vex_reg, rm_arg]) # addop("finit", [bs8(0x9b), bs8(0xdb), bs8(0xe3)]) addop("fninit", [bs8(0xdb), bs8(0xe3)]) diff --git a/miasm/arch/x86/sem.py b/miasm/arch/x86/sem.py index 15db7424..c4120566 100644 --- a/miasm/arch/x86/sem.py +++ b/miasm/arch/x86/sem.py @@ -4417,6 +4417,23 @@ def bextr(_, instr, dst, src1, src2): e.append(m2_expr.ExprAssign(dst, result)) return e, [] +def blsmsk(_, instr, dst, src): + e = [] + + tmp = src - m2_expr.ExprInt(1, src.size) + result = src ^ tmp + + e += update_flag_nf(result) + e.append(m2_expr.ExprAssign(of, m2_expr.ExprInt(0, of.size))) + e.append(m2_expr.ExprAssign(zf, m2_expr.ExprInt(0, zf.size))) + + e.append(m2_expr.ExprAssign(cf, m2_expr.ExprCond(src, + m2_expr.ExprInt(0, 1), + m2_expr.ExprInt(1, 1)))) + + e.append(m2_expr.ExprAssign(dst, result)) + return e, [] + def pshufb(_, instr, dst, src): e = [] if dst.size == 64: @@ -5551,6 +5568,7 @@ mnemo_func = {'mov': mov, "blsi": blsi, "andn": andn, "bextr": bextr, + "blsmsk": blsmsk, # # MMX/AVX/SSE operations diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 6d578dd9..7e44e903 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -2599,6 +2599,9 @@ reg_tests = [ (m64, "00000000 BEXTR RAX, RBX, RCX", "c4e2f0f7c3"), + (m64, "00000000 BLSMSK RAX, RBX", + "c4e2f8f3d3"), + #### MMX/SSE/AVX operations #### |