diff options
| author | Camille Mougey <commial@gmail.com> | 2015-03-16 07:58:00 +0100 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2015-03-16 07:58:00 +0100 |
| commit | 70619a87f16a850f3751c72953014408828df1e3 (patch) | |
| tree | b2d258b35c4ac029278ae90ef7df16c026a6c839 | |
| parent | 0bc14b77ea93a936995dd374a85a30cc0849d0e5 (diff) | |
| parent | fce912bce03b5e36b68791557fc2460a94e86cfe (diff) | |
| download | miasm-70619a87f16a850f3751c72953014408828df1e3.tar.gz miasm-70619a87f16a850f3751c72953014408828df1e3.zip | |
Merge pull request #113 from serpilliere/fix_x86_prefix_bin
Fix x86 prefix bin
| -rw-r--r-- | miasm2/core/cpu.py | 4 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index f8fdb4ff..e81c0daa 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -1164,7 +1164,7 @@ class cls_mn(object): a.expr = expr_simp(a.expr) c.l = prefix_len + total_l / 8 - c.b = cls.getbytes(bs, offset, total_l / 8) + c.b = cls.getbytes(bs, offset_o, c.l) c.offset = offset_o c = c.post_dis() if c is None: @@ -1173,7 +1173,7 @@ class cls_mn(object): instr = cls.instruction(c.name, mode, c_args, additional_info=c.additional_info()) instr.l = prefix_len + total_l / 8 - instr.b = cls.getbytes(bs, offset, total_l / 8) + instr.b = cls.getbytes(bs, offset_o, instr.l) instr.offset = offset_o instr.get_info(c) if c.alias: diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 7ec7b8c8..884d545b 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -1938,3 +1938,8 @@ import cProfile # cProfile.run(r'mn_x86.dis("\x81\x54\x18\xfe\x44\x33\x22\x11", m32)') cProfile.run('profile_dis(o)') # profile_dis(o) + +# Test instruction representation with prefix +instr_bytes = '\x65\xc7\x00\x09\x00\x00\x00' +inst = mn_x86.dis(instr_bytes, 32, 0) +assert(inst.b == instr_bytes) |