about summary refs log tree commit diff stats
path: root/miasm2/arch/x86/sem.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/arch/x86/sem.py')
-rw-r--r--miasm2/arch/x86/sem.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index f7f6ea75..18634551 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3582,6 +3582,33 @@ def pcmpeqw(ir, instr, a, b):
 def pcmpeqd(ir, instr, a, b):
     return pcmpeq(ir, instr, a, b, 32)
 
+
+
+
+def punpckh(ir, instr, a, b, size):
+    e = []
+    for i in xrange(a.size / (2 * size)):
+        src1 = a[size * i + a.size / 2 : size * i + a.size / 2 + size]
+        src2 = b[size * i + a.size / 2 : size * i + a.size / 2 + size]
+        e.append(m2_expr.ExprAff(a[size * 2 * i : size * 2 * i + size], src1))
+        e.append(m2_expr.ExprAff(a[size * (2 * i + 1) : size * (2 * i + 1) + size], src2))
+    return e, []
+
+
+def punpckhbw(ir, instr, a, b):
+    return punpckh(ir, instr, a, b, 8)
+
+def punpckhwd(ir, instr, a, b):
+    return punpckh(ir, instr, a, b, 16)
+
+def punpckhdq(ir, instr, a, b):
+    return punpckh(ir, instr, a, b, 32)
+
+def punpckhqdq(ir, instr, a, b):
+    return punpckh(ir, instr, a, b, 64)
+
+
+
 mnemo_func = {'mov': mov,
               'xchg': xchg,
               'movzx': movzx,
@@ -4017,6 +4044,11 @@ mnemo_func = {'mov': mov,
               "pcmpeqw" : pcmpeqw,
               "pcmpeqd" : pcmpeqd,
 
+              "punpckhbw" : punpckhbw,
+              "punpckhwd" : punpckhwd,
+              "punpckhdq" : punpckhdq,
+              "punpckhqdq" : punpckhqdq,
+
               }