diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-24 00:44:43 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-24 18:38:19 +0100 |
| commit | af7e524f56ba0bf1dce26b9c968c0806c418ea47 (patch) | |
| tree | 0c445178400e889ef725446838bcf7130e396d65 /miasm2/arch/x86/sem.py | |
| parent | 3ba62672ccb2190b7598ec5e362c670f031f74a9 (diff) | |
| download | miasm-af7e524f56ba0bf1dce26b9c968c0806c418ea47.tar.gz miasm-af7e524f56ba0bf1dce26b9c968c0806c418ea47.zip | |
X86: add pinsr
Diffstat (limited to 'miasm2/arch/x86/sem.py')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 32 |
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, + } |