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

Public Member Functions

def decode
 
def encode
 
def fromstring
 
def int2expr
 
def expr2int
 
def decodeval
 
def encodeval
 
def fromstring
 

Public Attributes

 expr
 
 value
 

Static Public Attributes

 parser = base_expr
 
int intsize = 32
 
tuple intmask = (1 << intsize)
 

Detailed Description

Definition at line 1072 of file arch.py.

Member Function Documentation

def miasm2.arch.aarch64.arch.aarch64_imm_nsr.decode (   self,
  v 
)

Definition at line 1075 of file arch.py.

1076  def decode(self, v):
1077  size = 64 if self.parent.sf.value else 32
1078  mask = UINTS[size]((1 << (v + 1)) - 1)
1079  mask = ror(mask, self.parent.immr.value, size)
1080  self.expr = m2_expr.ExprInt(mask, size)
1081  return True

+ Here is the call graph for this function:

def miasm2.core.cpu.imm_noarg.decodeval (   self,
  v 
)
inherited

Definition at line 1504 of file cpu.py.

1505  def decodeval(self, v):
1506  return v

+ Here is the caller graph for this function:

def miasm2.arch.aarch64.arch.aarch64_imm_nsr.encode (   self)

Definition at line 1082 of file arch.py.

1083  def encode(self):
1084  if not isinstance(self.expr, m2_expr.ExprInt):
1085  return False
1086  if not test_set_sf(self.parent, self.expr.size):
1087  return False
1088  value = self.expr.arg
1089  if value == 0:
1090  return False
1091 
1092  index = imm_to_imm_rot_form(value, self.expr.size)
1093  if index == None:
1094  return False
1095  power = int(rol(value, index, self.expr.size)) + 1
1096  length = None
1097  for i in xrange(self.expr.size):
1098  if 1 << i == power:
1099  length = i
1100  break
1101  if length is None:
1102  return False
1103  self.parent.immr.value = index
1104  self.value = length - 1
1105  self.parent.immn.value = 1 if self.expr.size == 64 else 0
1106  return True
1107 

+ Here is the call graph for this function:

def miasm2.core.cpu.imm_noarg.encodeval (   self,
  v 
)
inherited

Definition at line 1507 of file cpu.py.

1508  def encodeval(self, v):
1509  if v > self.lmask:
1510  return False
1511  return v

+ Here is the caller graph for this function:

def miasm2.core.cpu.imm_noarg.expr2int (   self,
  e 
)
inherited

Definition at line 1473 of file cpu.py.

1474  def expr2int(self, e):
1475  if not isinstance(e, m2_expr.ExprInt):
1476  return None
1477  v = int(e.arg)
1478  if v & ~self.intmask != 0:
1479  return None
1480  return v

+ Here is the caller graph for this function:

def miasm2.core.cpu.m_arg.fromstring (   self,
  s,
  parser_result = None 
)
inherited

Definition at line 604 of file cpu.py.

605  def fromstring(self, s, parser_result=None):
606  if parser_result:
607  e, start, stop = parser_result[self.parser]
608  self.expr = e
609  return start, stop
610  try:
611  v, start, stop = self.parser.scanString(s).next()
612  except StopIteration:
613  return None, None
614  self.expr = v[0]
615  return start, stop
616 

+ Here is the call graph for this function:

def miasm2.arch.aarch64.arch.aarch64_imm_sf.fromstring (   self,
  s,
  parser_result = None 
)
inherited

Definition at line 820 of file arch.py.

821  def fromstring(self, s, parser_result=None):
822  start, stop = super(aarch64_imm_sf, self).fromstring(s, parser_result)
823  if start is None:
824  return start, stop
825  size = self.parent.args[0].expr.size
826  if self.expr in gpregs64_info.expr + gpregs32_info.expr:
827  return None, None
828  if isinstance(self.expr, m2_expr.ExprOp):
829  return False
830  expr = set_imm_to_size(size, self.expr)
831  if expr is None:
832  return None, None
833  self.expr = expr
834  return start, stop

+ Here is the call graph for this function:

def miasm2.core.cpu.imm_noarg.int2expr (   self,
  v 
)
inherited

Definition at line 1468 of file cpu.py.

1469  def int2expr(self, v):
1470  if (v & ~self.intmask) != 0:
1471  return None
1472  return m2_expr.ExprInt(v, self.intsize)

+ Here is the caller graph for this function:

Member Data Documentation

miasm2.arch.aarch64.arch.aarch64_imm_nsr.expr

Definition at line 1079 of file arch.py.

tuple miasm2.core.cpu.imm_noarg.intmask = (1 << intsize)
staticinherited

Definition at line 1466 of file cpu.py.

int miasm2.core.cpu.imm_noarg.intsize = 32
staticinherited

Definition at line 1465 of file cpu.py.

miasm2.arch.aarch64.arch.aarch64_imm_nsr.parser = base_expr
static

Definition at line 1073 of file arch.py.

miasm2.arch.aarch64.arch.aarch64_imm_nsr.value

Definition at line 1103 of file arch.py.


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