Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Public Member Functions | Public Attributes | List of all members
miasm2.core.cpu.instruction Class Reference
+ Inheritance diagram for miasm2.core.cpu.instruction:
+ Collaboration diagram for miasm2.core.cpu.instruction:

Public Member Functions

def __init__
 
def gen_args
 
def __str__
 
def get_asm_offset
 
def resolve_args_with_symbols
 
def get_info
 

Public Attributes

 name
 
 mode
 
 args
 
 additional_info
 

Detailed Description

Definition at line 912 of file cpu.py.

Constructor & Destructor Documentation

def miasm2.core.cpu.instruction.__init__ (   self,
  name,
  mode,
  args,
  additional_info = None 
)

Definition at line 914 of file cpu.py.

915  def __init__(self, name, mode, args, additional_info=None):
916  self.name = name
917  self.mode = mode
918  self.args = args
919  self.additional_info = additional_info

Member Function Documentation

def miasm2.core.cpu.instruction.__str__ (   self)

Definition at line 924 of file cpu.py.

925  def __str__(self):
926  o = "%-10s " % self.name
927  args = []
928  for i, arg in enumerate(self.args):
929  if not isinstance(arg, m2_expr.Expr):
930  raise ValueError('zarb arg type')
931  x = self.arg2str(arg, pos = i)
932  args.append(x)
933  o += self.gen_args(args)
934  return o

+ Here is the call graph for this function:

def miasm2.core.cpu.instruction.gen_args (   self,
  args 
)

Definition at line 920 of file cpu.py.

921  def gen_args(self, args):
922  out = ', '.join([str(x) for x in args])
923  return out

+ Here is the caller graph for this function:

def miasm2.core.cpu.instruction.get_asm_offset (   self,
  expr 
)

Definition at line 935 of file cpu.py.

936  def get_asm_offset(self, expr):
937  return m2_expr.ExprInt_from(expr, self.offset)

+ Here is the caller graph for this function:

def miasm2.core.cpu.instruction.get_info (   self,
  c 
)

Definition at line 975 of file cpu.py.

976  def get_info(self, c):
977  return
978 
def miasm2.core.cpu.instruction.resolve_args_with_symbols (   self,
  symbols = None 
)

Definition at line 938 of file cpu.py.

939  def resolve_args_with_symbols(self, symbols=None):
940  if symbols is None:
941  symbols = {}
942  args_out = []
943  for a in self.args:
944  e = a
945  # try to resolve symbols using symbols (0 for default value)
946  ids = m2_expr.get_expr_ids(e)
947  fixed_ids = {}
948  for x in ids:
949  if isinstance(x.name, asmbloc.asm_label):
950  name = x.name.name
951  # special symbol $
952  if name == '$':
953  fixed_ids[x] = self.get_asm_offset(x)
954  continue
955  if not name in symbols:
956  raise ValueError('unresolved symbol! %r' % x)
957  else:
958  name = x.name
959  if not name in symbols:
960  continue
961  if symbols[name].offset is None:
962  raise ValueError('The offset of label "%s" cannot be '
963  'determined' % name)
964  else:
965  size = x.size
966  if size is None:
967  default_size = self.get_symbol_size(x, symbols)
968  size = default_size
969  value = m2_expr.ExprInt(symbols[name].offset, size)
970  fixed_ids[x] = value
971  e = e.replace_expr(fixed_ids)
972  e = expr_simp(e)
973  args_out.append(e)
974  return args_out

+ Here is the call graph for this function:

Member Data Documentation

miasm2.core.cpu.instruction.additional_info

Definition at line 918 of file cpu.py.

miasm2.core.cpu.instruction.args

Definition at line 917 of file cpu.py.

miasm2.core.cpu.instruction.mode

Definition at line 916 of file cpu.py.

miasm2.core.cpu.instruction.name

Definition at line 915 of file cpu.py.


The documentation for this class was generated from the following file: