about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/arch/x86/arch.py8
-rw-r--r--miasm2/arch/x86/sem.py8
-rw-r--r--test/arch/x86/arch.py12
3 files changed, 28 insertions, 0 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index 36666ea2..75fa2986 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -3879,6 +3879,14 @@ addop("pand", [bs8(0x0f), bs8(0xdb), no_xmm_pref] +
 addop("pand", [bs8(0x0f), bs8(0xdb), pref_66] +
       rmmod(xmm_reg, rm_arg_xmm), [xmm_reg, rm_arg_xmm])
 
+## ANDN
+# MMX
+addop("pandn", [bs8(0x0f), bs8(0xdf), no_xmm_pref] +
+      rmmod(mm_reg, rm_arg_mm), [mm_reg, rm_arg_mm])
+# SSE
+addop("pandn", [bs8(0x0f), bs8(0xdf), pref_66] +
+      rmmod(xmm_reg, rm_arg_xmm), [xmm_reg, rm_arg_xmm])
+
 ## OR
 # MMX
 addop("por", [bs8(0x0f), bs8(0xeb), no_xmm_pref] +
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 62b6b6b3..5fb7e34d 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3248,6 +3248,13 @@ def pand(ir, instr, a, b):
     e.append(m2_expr.ExprAff(a, c))
     return e, []
 
+def pandn(ir, instr, a, b):
+    e = []
+    c = (a ^ a.mask) & b
+    # No flag affected
+    e.append(m2_expr.ExprAff(a, c))
+    return e, []
+
 
 def por(ir, instr, a, b):
     e = []
@@ -3861,6 +3868,7 @@ mnemo_func = {'mov': mov,
               ###
 
               "pand": pand,
+              "pandn": pandn,
               "por": por,
 
               "rdmsr": rdmsr,
diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py
index 3c893049..a38cbcf3 100644
--- a/test/arch/x86/arch.py
+++ b/test/arch/x86/arch.py
@@ -2434,6 +2434,18 @@ reg_tests = [
     (m32, "00000000    PAND       XMM0, XMM4",
      "660fdbc4"),
 
+    (m32, "00000000    PANDN      MM2, MM6",
+     "0fdfd6"),
+    (m32, "00000000    PANDN      XMM2, XMM6",
+     "660fdfd6"),
+
+
+    (m32, "00000000    PANDN      MM0, MM4",
+     "0fdfc4"),
+    (m32, "00000000    PANDN      XMM0, XMM4",
+     "660fdfc4"),
+
+
     (m32, "00000000    POR        XMM0, XMM1",
      "660febc1"),
     (m32, "00000000    POR        XMM6, XMMWORD PTR [ECX+0x10]",