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

Public Member Functions

def decode
 
def encode
 
def fromstring
 

Public Attributes

 expr
 
 value
 

Static Public Attributes

 parser = deref
 

Detailed Description

Definition at line 820 of file arch.py.

Member Function Documentation

def miasm2.arch.arm.arch.arm_imm8_12.decode (   self,
  v 
)

Definition at line 823 of file arch.py.

824  def decode(self, v):
825  v = v & self.lmask
826  if self.parent.updown.value:
827  e = ExprInt32(v << 2)
828  else:
829  e = ExprInt32(-v << 2)
830  if self.parent.ppi.value:
831  e = ExprOp('preinc', self.parent.rn.expr, e)
832  else:
833  e = ExprOp('postinc', self.parent.rn.expr, e)
834  if self.parent.wback.value == 1:
835  e = ExprOp('wback', e)
836  self.expr = ExprMem(e)
837  return True

+ Here is the call graph for this function:

def miasm2.arch.arm.arch.arm_imm8_12.encode (   self)

Definition at line 838 of file arch.py.

839  def encode(self):
840  self.parent.updown.value = 1
841  e = self.expr
842  if not isinstance(e, ExprMem):
843  return False
844  e = e.arg
845  if isinstance(e, ExprOp) and e.op == 'wback':
846  self.parent.wback.value = 1
847  e = e.args[0]
848  else:
849  self.parent.wback.value = 0
850  if e.op == "postinc":
851  self.parent.ppi.value = 0
852  elif e.op == "preinc":
853  self.parent.ppi.value = 1
854  else:
855  # XXX default
856  self.parent.ppi.value = 1
857  self.parent.rn.expr = e.args[0]
858  if len(e.args) == 1:
859  self.value = 0
860  return True
861  e = e.args[1]
862  if not isinstance(e, ExprInt):
863  log.debug('should be int %r', e)
864  return False
865  v = int(e.arg)
866  if v < 0 or v & (1 << 31):
867  self.parent.updown.value = 0
868  v = -v & 0xFFFFFFFF
869  if v & 0x3:
870  log.debug('arg should be 4 aligned')
871  return False
872  v >>= 2
873  self.value = v
874  return True
875 
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:

Member Data Documentation

miasm2.arch.arm.arch.arm_imm8_12.expr

Definition at line 835 of file arch.py.

miasm2.arch.arm.arch.arm_imm8_12.parser = deref
static

Definition at line 821 of file arch.py.

miasm2.arch.arm.arch.arm_imm8_12.value

Definition at line 858 of file arch.py.


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