diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-23 18:19:03 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-23 19:54:31 +0100 |
| commit | f39a91b146c4a2eb8424f4ad8dec53b96a2a56ab (patch) | |
| tree | b6690e4c93a682aca03405077db4d7aee26ef9ce | |
| parent | 7e29868e5c637c0608ba257ac6a524ceb3e19e96 (diff) | |
| download | miasm-f39a91b146c4a2eb8424f4ad8dec53b96a2a56ab.tar.gz miasm-f39a91b146c4a2eb8424f4ad8dec53b96a2a56ab.zip | |
X86: add pushfb
| -rw-r--r-- | example/jitter/x86_32.py | 1 | ||||
| -rw-r--r-- | miasm2/arch/x86/arch.py | 7 | ||||
| -rw-r--r-- | miasm2/arch/x86/sem.py | 21 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 5 |
4 files changed, 32 insertions, 2 deletions
diff --git a/example/jitter/x86_32.py b/example/jitter/x86_32.py index 1b2aa012..2eee1742 100644 --- a/example/jitter/x86_32.py +++ b/example/jitter/x86_32.py @@ -38,4 +38,3 @@ myjit.add_breakpoint(0x1337beef, code_sentinelle) myjit.init_run(run_addr) myjit.continue_run() -del(myjit) diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index 74ac0939..36666ea2 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -3895,6 +3895,13 @@ addop("pxor", [bs8(0x0f), bs8(0xef), no_xmm_pref] + addop("pxor", [bs8(0x0f), bs8(0xef), pref_66] + rmmod(xmm_reg, rm_arg_xmm)) +addop("pshufb", [bs8(0x0f), bs8(0x38), bs8(0x00), no_xmm_pref] + + rmmod(mm_reg, rm_arg_mm)) +addop("pshufb", [bs8(0x0f), bs8(0x38), bs8(0x00), pref_66] + + rmmod(xmm_reg, rm_arg_xmm)) + + + ### Convert ### SS = single precision ### SD = double precision diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 802b6283..62b6b6b3 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -3422,6 +3422,25 @@ def ucomiss(ir, instr, a, b): return e, [] + +def pshufb(ir, instr, a, b): + e = [] + if a.size == 64: + bit_l = 3 + elif a.size == 128: + bit_l = 4 + else: + raise NotImplementedError("bad size") + for i in xrange(0, b.size, 8): + index = b[i:i+bit_l].zeroExtend(a.size) << m2_expr.ExprInt(3, a.size) + value = (a >> index)[:8] + e.append(m2_expr.ExprAff(a[i:i+8], + m2_expr.ExprCond(b[i+7:i+8], + m2_expr.ExprInt8(0), + value))) + return e, [] + + def iret(ir, instr): """IRET implementation XXX: only support "no-privilege change" @@ -3846,7 +3865,7 @@ mnemo_func = {'mov': mov, "rdmsr": rdmsr, "wrmsr": wrmsr, - + "pshufb" : pshufb, } diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 7d6260a2..3c893049 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -2574,6 +2574,11 @@ reg_tests = [ (m32, "00000000 COMISD XMM7, XMM6", "660F2FFE"), + (m32, "00000000 PSHUFB MM6, QWORD PTR [ESI]", + "0F380036"), + (m32, "00000000 PSHUFB XMM6, XMMWORD PTR [ESI]", + "660F380036"), + ] |