diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-23 23:22:09 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-24 18:38:19 +0100 |
| commit | d2dc89a03a1fe475844a0ae5098604b0ae0a8525 (patch) | |
| tree | f69b2b3fed3379561cf223a09a2608ea5318ae9f | |
| parent | d5029cf5db186414413fe45601f66b333b89599c (diff) | |
| download | miasm-d2dc89a03a1fe475844a0ae5098604b0ae0a8525.tar.gz miasm-d2dc89a03a1fe475844a0ae5098604b0ae0a8525.zip | |
X86: add punpckl
Diffstat (limited to '')
| -rw-r--r-- | miasm2/arch/x86/arch.py | 20 | ||||
| -rw-r--r-- | miasm2/arch/x86/sem.py | 33 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 20 |
3 files changed, 65 insertions, 8 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index 1ef46499..89683e31 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -4089,6 +4089,26 @@ addop("punpckhqdq", [bs8(0x0f), bs8(0x6d), pref_66] + rmmod(xmm_reg, rm_arg_xmm)) + +addop("punpcklbw", [bs8(0x0f), bs8(0x60), no_xmm_pref] + + rmmod(mm_reg, rm_arg_mm)) +addop("punpcklbw", [bs8(0x0f), bs8(0x60), pref_66] + + rmmod(xmm_reg, rm_arg_xmm)) + +addop("punpcklwd", [bs8(0x0f), bs8(0x61), no_xmm_pref] + + rmmod(mm_reg, rm_arg_mm)) +addop("punpcklwd", [bs8(0x0f), bs8(0x61), pref_66] + + rmmod(xmm_reg, rm_arg_xmm)) + +addop("punpckldq", [bs8(0x0f), bs8(0x62), no_xmm_pref] + + rmmod(mm_reg, rm_arg_mm)) +addop("punpckldq", [bs8(0x0f), bs8(0x62), pref_66] + + rmmod(xmm_reg, rm_arg_xmm)) + +addop("punpcklqdq", [bs8(0x0f), bs8(0x6c), pref_66] + + rmmod(xmm_reg, rm_arg_xmm)) + + 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 18634551..0312d002 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -3585,27 +3585,40 @@ def pcmpeqd(ir, instr, a, b): -def punpckh(ir, instr, a, b, size): +def punpck(ir, instr, a, b, size, off): 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] + src1 = a[size * i + off : size * i + off + size] + src2 = b[size * i + off : size * i + off + 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) + return punpck(ir, instr, a, b, 8, a.size / 2) def punpckhwd(ir, instr, a, b): - return punpckh(ir, instr, a, b, 16) + return punpck(ir, instr, a, b, 16, a.size / 2) def punpckhdq(ir, instr, a, b): - return punpckh(ir, instr, a, b, 32) + return punpck(ir, instr, a, b, 32, a.size / 2) def punpckhqdq(ir, instr, a, b): - return punpckh(ir, instr, a, b, 64) + return punpck(ir, instr, a, b, 64, a.size / 2) + + +def punpcklbw(ir, instr, a, b): + return punpck(ir, instr, a, b, 8, 0) + +def punpcklwd(ir, instr, a, b): + return punpck(ir, instr, a, b, 16, 0) + +def punpckldq(ir, instr, a, b): + return punpck(ir, instr, a, b, 32, 0) + +def punpcklqdq(ir, instr, a, b): + return punpck(ir, instr, a, b, 64, 0) @@ -4049,6 +4062,12 @@ mnemo_func = {'mov': mov, "punpckhdq" : punpckhdq, "punpckhqdq" : punpckhqdq, + + "punpcklbw" : punpcklbw, + "punpcklwd" : punpcklwd, + "punpckldq" : punpckldq, + "punpcklqdq" : punpcklqdq, + } diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 8a9402a0..2048dda4 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -2707,10 +2707,28 @@ reg_tests = [ (m32, "00000000 PUNPCKHDQ XMM2, XMMWORD PTR [EDX]", "660F6A12"), - (m32, "00000000 PUNPCKHQDQ XMM2, XMMWORD PTR [EDX]", "660F6D12"), + + (m32, "00000000 PUNPCKLBW MM2, QWORD PTR [EDX]", + "0F6012"), + (m32, "00000000 PUNPCKLBW XMM2, XMMWORD PTR [EDX]", + "660F6012"), + + (m32, "00000000 PUNPCKLWD MM2, QWORD PTR [EDX]", + "0F6112"), + (m32, "00000000 PUNPCKLWD XMM2, XMMWORD PTR [EDX]", + "660F6112"), + + (m32, "00000000 PUNPCKLDQ MM2, QWORD PTR [EDX]", + "0F6212"), + (m32, "00000000 PUNPCKLDQ XMM2, XMMWORD PTR [EDX]", + "660F6212"), + + (m32, "00000000 PUNPCKLQDQ XMM2, XMMWORD PTR [EDX]", + "660F6C12"), + ] |