diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-07 19:43:18 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-07 19:43:18 +0200 |
| commit | 12bedca7aa29490d62891b464c65bf29f2aa31e4 (patch) | |
| tree | 2b1095f8e166917e28f60583cc9592c984b82bcd /miasm2/analysis/sandbox.py | |
| parent | 17ffdf4c6b982f4762184a46f1ffbbb0cc36eed8 (diff) | |
| download | miasm-12bedca7aa29490d62891b464c65bf29f2aa31e4.tar.gz miasm-12bedca7aa29490d62891b464c65bf29f2aa31e4.zip | |
Sandbox: add arm arch
Diffstat (limited to 'miasm2/analysis/sandbox.py')
| -rw-r--r-- | miasm2/analysis/sandbox.py | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/miasm2/analysis/sandbox.py b/miasm2/analysis/sandbox.py index f66f5913..8a1e1ca4 100644 --- a/miasm2/analysis/sandbox.py +++ b/miasm2/analysis/sandbox.py @@ -86,7 +86,7 @@ class Sandbox(object): @addr: (int) start address """ if addr is None and self.options.address is not None: - addr = int(options.address, 16) + addr = int(self.options.address, 16) if any([self.options.debugging, self.options.gdbserver]): dbg = debugging.Debugguer(self.jitter) @@ -245,6 +245,19 @@ class Arch_x86_32(Arch): help="Use segments fs:") +class Arch_arml(Arch): + _ARCH_ = "arm" + STACK_SIZE = 0x100000 + + def __init__(self): + super(Arch_arml, self).__init__() + + # Init stack + self.jitter.stack_size = self.STACK_SIZE + self.jitter.init_stack() + + + class Sandbox_Win_x86_32(Sandbox, Arch_x86_32, OS_Win): @staticmethod @@ -303,3 +316,27 @@ class Sandbox_Linux_x86_32(Sandbox, Arch_x86_32, OS_Linux): if addr is None: addr = self.entry_point super(Sandbox_Linux_x86_32, self).run(addr) + + + +class Sandbox_Linux_arml(Sandbox, Arch_arml, OS_Linux): + + @staticmethod + def code_sentinelle(jitter): + print 'Emulation stop' + jitter.run = False + return False + + def __init__(self, *args, **kwargs): + Sandbox.__init__(self, *args, **kwargs) + + self.jitter.cpu.LR = 0x1337beef + + # Set the runtime guard + self.jitter.add_breakpoint(0x1337beef, self.__class__.code_sentinelle) + + + def run(self, addr = None): + if addr is None and self.options.address is not None: + addr = int(self.options.address, 16) + super(Sandbox_Linux_arml, self).run(addr) |