about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/arch/x86/arch.py11
-rw-r--r--miasm2/arch/x86/sem.py11
2 files changed, 22 insertions, 0 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index efa955f3..36e2e3b7 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -2327,6 +2327,11 @@ class x86_rm_xmm_reg(x86_rm_mm):
     is_mm = False
     is_xmm = True
 
+class x86_rm_mm_reg(x86_rm_mm):
+    msize = None
+    is_mm = True
+    is_xmm = False
+
 class x86_rm_reg_noarg(object):
     prio = default_prio + 1
 
@@ -3134,6 +3139,7 @@ rm_arg_m16 = bs(l=0, cls=(x86_rm_m16,), fname='rmarg')
 
 rm_arg_mm = bs(l=0, cls=(x86_rm_mm,), fname='rmarg')
 rm_arg_mm_m64 = bs(l=0, cls=(x86_rm_mm_m64,), fname='rmarg')
+rm_arg_mm_reg = bs(l=0, cls=(x86_rm_mm_reg,), fname='rmarg')
 
 rm_arg_xmm = bs(l=0, cls=(x86_rm_xmm,), fname='rmarg')
 rm_arg_xmm_m32 = bs(l=0, cls=(x86_rm_xmm_m32,), fname='rmarg')
@@ -4244,6 +4250,11 @@ addop("sqrtsd", [bs8(0x0f), bs8(0x51), pref_f2] +
 addop("sqrtss", [bs8(0x0f), bs8(0x51), pref_f3] +
       rmmod(xmm_reg, rm_arg_xmm_m32))
 
+addop("pmovmskb", [bs8(0x0f), bs8(0xd7), no_xmm_pref] +
+      rmmod(reg, rm_arg_mm_reg))
+addop("pmovmskb", [bs8(0x0f), bs8(0xd7), pref_66] +
+      rmmod(reg, rm_arg_xmm_reg))
+
 
 mn_x86.bintree = factor_one_bit(mn_x86.bintree)
 # mn_x86.bintree = factor_fields_all(mn_x86.bintree)
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index a9737923..ff27937f 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3949,6 +3949,15 @@ def sqrtss(ir, instr, a, b):
     return e, []
 
 
+def pmovmskb(ir, instr, a, b):
+    e = []
+    out = []
+    for i in xrange(b.size / 8):
+        out.append((b[8 * i + 7:8 * (i + 1)], i, i + 1))
+    src = m2_expr.ExprCompose(out)
+    e.append(m2_expr.ExprAff(a, src.zeroExtend(a.size)))
+    return e, []
+
 mnemo_func = {'mov': mov,
               'xchg': xchg,
               'movzx': movzx,
@@ -4426,6 +4435,8 @@ mnemo_func = {'mov': mov,
               "sqrtsd": sqrtsd,
               "sqrtss": sqrtss,
 
+              "pmovmskb": pmovmskb,
+
               }