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

Public Member Functions

def flen
 
def fromstring
 
def encode
 
def decode
 
def getmaxlen
 
def clone
 
def __hash__
 

Public Attributes

 expr
 
 l
 
 value
 
 flen
 
 parent
 
 strbits
 
 cls
 
 fname
 
 order
 
 lmask
 
 fbits
 
 fmask
 
 kargs
 

Static Public Attributes

 parser = int_or_expr
 
int max_size = 32
 
int ll = 2
 

Detailed Description

Definition at line 2780 of file arch.py.

Member Function Documentation

def miasm2.core.cpu.bsi.__hash__ (   self)
inherited

Definition at line 493 of file cpu.py.

494  def __hash__(self):
495  kargs = []
496  for k, v in self.kargs.items():
497  if isinstance(v, list):
498  v = tuple(v)
499  kargs.append((k, v))
500  l = [self.strbits, self.l, self.cls,
501  self.fname, self.order, self.lmask, self.fbits,
502  self.fmask, self.value] # + kargs
503 
504  return hash(tuple(l))
505 
def miasm2.core.cpu.bsi.clone (   self)
inherited

Definition at line 483 of file cpu.py.

484  def clone(self):
485  s = self.__class__(self.parent,
486  self.strbits, self.l, self.cls,
487  self.fname, self.order, self.lmask, self.fbits,
488  self.fmask, self.value, self.flen, **self.kargs)
489  s.__dict__.update(self.kargs)
490  if hasattr(self, 'expr'):
491  s.expr = self.expr
492  return s
def miasm2.arch.x86.arch.bs_rel_off.decode (   self,
  v 
)
inherited

Definition at line 2738 of file arch.py.

2739  def decode(self, v):
2740  v = swap_uint(self.l, v)
2741  size = offsize(self.parent)
2742  v = sign_ext(v, self.l, size)
2743  v += self.parent.l
2744  self.expr = ExprInt(v, size)
2745  return True
def swap_uint
Definition: cpu.py:1578
def sign_ext
Definition: cpu.py:1602

+ Here is the call graph for this function:

def miasm2.arch.x86.arch.bs_rel_off.encode (   self)
inherited

Definition at line 2713 of file arch.py.

2714  def encode(self):
2715  if not isinstance(self.expr, ExprInt):
2716  raise StopIteration
2717  arg0_expr = self.parent.args[0].expr
2718  if self.l != 0:
2719  l = self.l
2720  else:
2721  l = self.parent.v_opmode()
2722  self.l = l
2723  l = offsize(self.parent)
2724  prefix = self.parent.gen_prefix()
2725  parent_len = len(prefix) * 8 + self.parent.l + self.l
2726  assert(parent_len % 8 == 0)
2727 
2728  v = int(self.expr.arg - parent_len/8)
2729  if prefix is None:
2730  raise StopIteration
2731  mask = ((1 << self.l) - 1)
2732  if self.l > l:
2733  raise StopIteration
2734  if v != sign_ext(v & mask, self.l, l):
2735  raise StopIteration
2736  self.value = swap_uint(self.l, v & ((1 << self.l) - 1))
2737  yield True
def swap_uint
Definition: cpu.py:1578
def sign_ext
Definition: cpu.py:1602
def miasm2.arch.x86.arch.bs_rel_off08.flen (   cls,
  mode,
  v 
)

Definition at line 2783 of file arch.py.

2784  def flen(cls, mode, v):
2785  return 8
2786 
def miasm2.arch.x86.arch.bs_rel_off.fromstring (   self,
  s,
  parser_result = None 
)
inherited

Definition at line 2689 of file arch.py.

2690  def fromstring(self, s, parser_result=None):
2691  if parser_result:
2692  expr, start, stop = parser_result[self.parser]
2693  else:
2694  try:
2695  expr, start, stop = self.parser.scanString(s).next()
2696  except StopIteration:
2697  expr = None
2698  self.expr = expr
2699  l = self.parent.mode
2700  if isinstance(self.expr, ExprInt):
2701  v = int(self.expr.arg)
2702  mask = ((1 << l) - 1)
2703  self.expr = ExprInt(v & mask, l)
2704  return start, stop
def miasm2.arch.x86.arch.bs_cond_imm.getmaxlen (   self)
inherited

Definition at line 2597 of file arch.py.

2598  def getmaxlen(self):
2599  return 32

Member Data Documentation

miasm2.core.cpu.bsi.cls
inherited

Definition at line 465 of file cpu.py.

miasm2.arch.x86.arch.bs_rel_off.expr
inherited

Definition at line 2697 of file arch.py.

miasm2.core.cpu.bsi.fbits
inherited

Definition at line 469 of file cpu.py.

miasm2.core.cpu.bsi.flen
inherited

Definition at line 471 of file cpu.py.

miasm2.core.cpu.bsi.fmask
inherited

Definition at line 470 of file cpu.py.

miasm2.core.cpu.bsi.fname
inherited

Definition at line 466 of file cpu.py.

miasm2.core.cpu.bsi.kargs
inherited

Definition at line 473 of file cpu.py.

miasm2.arch.x86.arch.bs_rel_off.l
inherited

Definition at line 2721 of file arch.py.

int miasm2.arch.x86.arch.bs_cond_scale.ll = 2
staticinherited

Definition at line 2475 of file arch.py.

miasm2.core.cpu.bsi.lmask
inherited

Definition at line 468 of file cpu.py.

int miasm2.arch.x86.arch.bs_cond_imm.max_size = 32
staticinherited

Definition at line 2560 of file arch.py.

miasm2.core.cpu.bsi.order
inherited

Definition at line 467 of file cpu.py.

miasm2.core.cpu.bsi.parent
inherited

Definition at line 462 of file cpu.py.

miasm2.arch.x86.arch.bs_rel_off.parser = int_or_expr
staticinherited

Definition at line 2687 of file arch.py.

miasm2.core.cpu.bsi.strbits
inherited

Definition at line 463 of file cpu.py.

miasm2.arch.x86.arch.bs_rel_off.value
inherited

Definition at line 2735 of file arch.py.


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