Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
jit.py
Go to the documentation of this file.
1 from miasm2.jitter.jitload import jitter
2 from miasm2.core import asmbloc
3 from miasm2.core.utils import *
4 from miasm2.arch.mips32.sem import ir_mips32l, ir_mips32b
5 
6 import logging
7 
8 log = logging.getLogger('jit_mips32')
9 hnd = logging.StreamHandler()
10 hnd.setFormatter(logging.Formatter("[%(levelname)s]: %(message)s"))
11 log.addHandler(hnd)
12 log.setLevel(logging.CRITICAL)
13 
15 
16  def __init__(self, *args, **kwargs):
17  sp = asmbloc.asm_symbol_pool()
18  jitter.__init__(self, ir_mips32l(sp), *args, **kwargs)
19  self.vm.set_little_endian()
20  self.ir_arch.jit_pc = self.ir_arch.arch.regs.PC
21 
22  def push_uint32_t(self, v):
23  self.cpu.SP -= 4
24  self.vm.set_mem(self.cpu.SP, pck32(v))
25 
26  def pop_uint32_t(self):
27  x = upck32(self.vm.get_mem(self.cpu.SP, 4))
28  self.cpu.SP += 4
29  return x
30 
31  def get_stack_arg(self, n):
32  x = upck32(self.vm.get_mem(self.cpu.SP + 4 * n, 4))
33  return x
34 
35  def init_run(self, *args, **kwargs):
36  jitter.init_run(self, *args, **kwargs)
37  self.cpu.PC = self.pc
38 
39 
41  def __init__(self, *args, **kwargs):
42  sp = asmbloc.asm_symbol_pool()
43  jitter.__init__(self, ir_mips32b(sp), *args, **kwargs)
44  self.vm.set_big_endian()
45  self.ir_arch.jit_pc = self.ir_arch.arch.regs.PC
tuple upck32
Definition: utils.py:8
tuple pck32
Definition: utils.py:12