diff options
| author | Camille Mougey <commial@gmail.com> | 2018-07-18 19:04:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-18 19:04:06 +0200 |
| commit | 63edfb9952969263f284b236678fbf93f81e6ac0 (patch) | |
| tree | 43d5a897a95b1429bd9382d6ff689ce14ac234c7 | |
| parent | b531a52db0a966f0882e386e164a349ae581f956 (diff) | |
| parent | 3b146b53c4b6ec12806b670eb215bb44482642e1 (diff) | |
| download | miasm-63edfb9952969263f284b236678fbf93f81e6ac0.tar.gz miasm-63edfb9952969263f284b236678fbf93f81e6ac0.zip | |
Merge pull request #802 from serpilliere/fix_x86_asm_64
X86: fix 64 bit asm
| -rw-r--r-- | miasm2/arch/x86/arch.py | 2 | ||||
| -rw-r--r-- | miasm2/core/cpu.py | 2 | ||||
| -rw-r--r-- | test/arch/x86/unit/test_asm_x86_64.py | 30 | ||||
| -rwxr-xr-x | test/test_all.py | 1 |
4 files changed, 33 insertions, 2 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index bf872667..3a0fb78e 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -256,7 +256,7 @@ cl_or_imm |= base_expr class x86_arg(m_arg): def asm_ast_to_expr(self, value, loc_db, size_hint=None, fixed_size=None): if size_hint is None: - size_hint = self.parent.v_opmode() + size_hint = self.parent.mode if fixed_size is None: fixed_size = set() if isinstance(value, AstId): diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index 1326d08b..686e12ba 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -1036,7 +1036,7 @@ class instruction(object): offset = symbols.get_location_offset(loc_key) if offset is None: raise ValueError( - 'The offset of loc_key "%s" cannot be determined' % name + 'The offset of loc_key "%s" cannot be determined' % names ) else: # Fix symbol with its offset diff --git a/test/arch/x86/unit/test_asm_x86_64.py b/test/arch/x86/unit/test_asm_x86_64.py new file mode 100644 index 00000000..4e600846 --- /dev/null +++ b/test/arch/x86/unit/test_asm_x86_64.py @@ -0,0 +1,30 @@ +from miasm2.core import asmblock +from miasm2.arch.x86 import arch +from miasm2.core import parse_asm +from miasm2.core.interval import interval + +my_mn = arch.mn_x86 + + +asmcfg, loc_db = parse_asm.parse_txt(my_mn, 64, r''' +main: + PUSH RBP + MOV RBP, RSP +loop_dec: + CMP RCX, RDX + JB loop_dec +end: + MOV RSP, RBP + POP RBP + RET + +''') + +loc_db.set_location_offset(loc_db.get_name_location("main"), 0x100001000) +dst_interval = interval([(0x100001000, 0x100002000)]) +patches = asmblock.asm_resolve_final( + my_mn, + asmcfg, + loc_db, + dst_interval +) diff --git a/test/test_all.py b/test/test_all.py index 81b6e6e5..3fb0a5b7 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -81,6 +81,7 @@ for script in ["x86/sem.py", "x86/unit/mn_seh.py", "x86/unit/mn_cpuid.py", "x86/unit/mn_div.py", + "x86/unit/test_asm_x86_64.py", "arm/arch.py", "arm/sem.py", "aarch64/unit/mn_ubfm.py", |