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 0312d002..9b20196d 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3622,6 +3622,33 @@ def punpcklqdq(ir, instr, a, b):
 
 
 
+def pinsr(ir, instr, a, b, c, size):
+    e = []
+
+    mask = {8 : 0xF,
+           16 : 0x7,
+           32 : 0x3,
+           64 : 0x1}[size]
+
+    sel = (int(c.arg) & mask) * size
+    e.append(m2_expr.ExprAff(a[sel:sel+size], b[:size]))
+
+    return e, []
+
+def pinsrb(ir, instr, a, b, c):
+    return pinsr(ir, instr, a, b, c, 8)
+
+def pinsrw(ir, instr, a, b, c):
+    return pinsr(ir, instr, a, b, c, 16)
+
+def pinsrd(ir, instr, a, b, c):
+    return pinsr(ir, instr, a, b, c, 32)
+
+def pinsrq(ir, instr, a, b, c):
+    return pinsr(ir, instr, a, b, c, 64)
+
+
+
 mnemo_func = {'mov': mov,
               'xchg': xchg,
               'movzx': movzx,
@@ -4068,6 +4095,11 @@ mnemo_func = {'mov': mov,
               "punpckldq" : punpckldq,
               "punpcklqdq" : punpcklqdq,
 
+              "pinsrb" : pinsrb,
+              "pinsrw" : pinsrw,
+              "pinsrd" : pinsrd,
+              "pinsrq" : pinsrq,
+
               }