Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Classes | Functions
miasm2.jitter.jitcore_python Namespace Reference

Classes

class  JitCore_Python
 Python jitter Core #. More...
 

Functions

def update_cpu_from_engine
 Util methods for Python jitter #. More...
 
def update_engine_from_cpu
 

Function Documentation

def miasm2.jitter.jitcore_python.update_cpu_from_engine (   cpu,
  exec_engine 
)

Util methods for Python jitter #.

Updates @cpu instance according to new CPU values
@cpu: JitCpu instance
@exec_engine: symbexec instance

Definition at line 12 of file jitcore_python.py.

12 
13 def update_cpu_from_engine(cpu, exec_engine):
14  """Updates @cpu instance according to new CPU values
15  @cpu: JitCpu instance
16  @exec_engine: symbexec instance"""
17 
18  for symbol in exec_engine.symbols:
19  if isinstance(symbol, m2_expr.ExprId):
20  if hasattr(cpu, symbol.name):
21  value = exec_engine.symbols.symbols_id[symbol]
22  if not isinstance(value, m2_expr.ExprInt):
23  raise ValueError("A simplification is missing: %s" % value)
24 
25  setattr(cpu, symbol.name, value.arg.arg)
26  else:
27  raise NotImplementedError("Type not handled: %s" % symbol)
28 
def update_cpu_from_engine
Util methods for Python jitter #.

+ Here is the caller graph for this function:

def miasm2.jitter.jitcore_python.update_engine_from_cpu (   cpu,
  exec_engine 
)
Updates CPU values according to @cpu instance
@cpu: JitCpu instance
@exec_engine: symbexec instance

Definition at line 29 of file jitcore_python.py.

29 
30 def update_engine_from_cpu(cpu, exec_engine):
31  """Updates CPU values according to @cpu instance
32  @cpu: JitCpu instance
33  @exec_engine: symbexec instance"""
34 
35  for symbol in exec_engine.symbols:
36  if isinstance(symbol, m2_expr.ExprId):
37  if hasattr(cpu, symbol.name):
38  value = m2_expr.ExprInt(getattr(cpu, symbol.name),
39  symbol.size)
40  exec_engine.symbols.symbols_id[symbol] = value
41  else:
42  raise NotImplementedError("Type not handled: %s" % symbol)
43 

+ Here is the caller graph for this function: