diff options
| author | Camille Mougey <commial@gmail.com> | 2018-03-05 13:18:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-05 13:18:22 +0100 |
| commit | 342614c1ec4bedd5bcc089ba01909a66b9a73aba (patch) | |
| tree | 683728881150e2406849bcc1e1c13c62bc0b6d44 /miasm2/jitter/emulatedsymbexec.py | |
| parent | a3013003b9f77b017036bd1d46797052d875efbe (diff) | |
| parent | 5d5c768db62da037d156808f528cf9c1e14db8ab (diff) | |
| download | miasm-342614c1ec4bedd5bcc089ba01909a66b9a73aba.tar.gz miasm-342614c1ec4bedd5bcc089ba01909a66b9a73aba.zip | |
Merge pull request #690 from serpilliere/integrate_ppc
Integrate ppc
Diffstat (limited to 'miasm2/jitter/emulatedsymbexec.py')
| -rw-r--r-- | miasm2/jitter/emulatedsymbexec.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/miasm2/jitter/emulatedsymbexec.py b/miasm2/jitter/emulatedsymbexec.py index 97f038dc..4107dc75 100644 --- a/miasm2/jitter/emulatedsymbexec.py +++ b/miasm2/jitter/emulatedsymbexec.py @@ -44,9 +44,11 @@ class EmulatedSymbExec(SymbolicExecutionEngine): addr = expr_mem.arg.arg.arg size = expr_mem.size / 8 value = self.cpu.get_mem(addr, size) + if self.vm.is_little_endian(): + value = value[::-1] self.vm.add_mem_read(addr, size) - return m2_expr.ExprInt(int(value[::-1].encode("hex"), 16), + return m2_expr.ExprInt(int(value.encode("hex"), 16), expr_mem.size) def _func_write(self, symb_exec, dest, data): @@ -66,7 +68,10 @@ class EmulatedSymbExec(SymbolicExecutionEngine): size = data.size / 8 content = hex(to_write).replace("0x", "").replace("L", "") content = "0" * (size * 2 - len(content)) + content - content = content.decode("hex")[::-1] + content = content.decode("hex") + + if self.vm.is_little_endian(): + content = content[::-1] # Write in VmMngr context self.cpu.set_mem(addr, content) |