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.x86_s08to16 Class Reference
+ Inheritance diagram for miasm2.arch.x86.arch.x86_s08to16:
+ Collaboration diagram for miasm2.arch.x86.arch.x86_s08to16:

Public Member Functions

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

Public Attributes

 expr
 
 out_size
 
 value
 

Static Public Attributes

int in_size = 8
 
int out_size = 16
 
 parser = base_expr
 
int intsize = 32
 
tuple intmask = (1 << intsize)
 

Detailed Description

Definition at line 1107 of file arch.py.

Member Function Documentation

def miasm2.arch.x86.arch.x86_s08to16.decode (   self,
  v 
)

Definition at line 1125 of file arch.py.

1126  def decode(self, v):
1127  v = v & self.lmask
1128  v = self.decodeval(v)
1129  if self.parent.v_opmode() == 64:
1130  self.expr = ExprInt64(sign_ext(v, self.in_size, 64))
1131  else:
1132  if (1 << (self.l - 1)) & v:
1133  v = sign_ext(v, self.l, self.out_size)
1134  self.expr = self.myexpr(v)
1135  return True
def sign_ext
Definition: cpu.py:1602

+ Here is the call graph for this function:

def miasm2.arch.x86.arch.x86_s08to16.decodeval (   self,
  v 
)

Definition at line 1165 of file arch.py.

1166  def decodeval(self, v):
1167  return swap_uint(self.l, v)
def swap_uint
Definition: cpu.py:1578

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.arch.x86_s08to16.encode (   self)

Definition at line 1136 of file arch.py.

1137  def encode(self):
1138  if not isinstance(self.expr, ExprInt):
1139  return False
1140  v = int(self.expr.arg)
1141  opmode = self.parent.v_opmode()
1142 
1143  out_size = self.out_size
1144  if opmode != self.out_size:
1145  if opmode == 32 and self.out_size == 64:
1146  out_size = opmode
1147  if v == sign_ext(
1148  int(v & ((1 << self.in_size) - 1)), self.in_size, out_size):
1149  pass
1150  else:
1151  # test with rex_w
1152  self.parent.rex_w.value = 1
1153  opmode = self.parent.v_opmode()
1154  out_size = opmode
1155  if (v != sign_ext(
1156  int(v & ((1 << self.in_size) - 1)),
1157  self.in_size, out_size)):
1158  return False
1159  if v != sign_ext(
1160  int(v & ((1 << self.in_size) - 1)), self.in_size, out_size):
1161  return False
1162  v = self.encodeval(v)
1163  self.value = (v & 0xffffffff) & self.lmask
1164  return True
def sign_ext
Definition: cpu.py:1602
def miasm2.arch.x86.arch.x86_s08to16.encodeval (   self,
  v 
)

Definition at line 1168 of file arch.py.

1169  def encodeval(self, v):
1170  return swap_sint(self.l, v)
1171 
def swap_sint
Definition: cpu.py:1590

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.arch.x86_s08to16.expr2int (   self,
  e 
)

Definition at line 1117 of file arch.py.

1118  def expr2int(self, e):
1119  if not isinstance(e, ExprInt):
1120  return None
1121  v = int(e.arg)
1122  if v & ~((1 << self.l) - 1) != 0:
1123  return None
1124  return v

+ Here is the caller graph for this function:

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

Definition at line 1481 of file cpu.py.

1482  def fromstring(self, s, parser_result=None):
1483  if parser_result:
1484  e, start, stop = parser_result[self.parser]
1485  else:
1486  try:
1487  e, start, stop = self.parser.scanString(s).next()
1488  except StopIteration:
1489  return None, None
1490  if e is None:
1491  return None, None
1492 
1493  assert(isinstance(e, m2_expr.Expr))
1494  if isinstance(e, tuple):
1495  self.expr = self.int2expr(e[1])
1496  elif isinstance(e, m2_expr.Expr):
1497  self.expr = e
1498  else:
1499  raise TypeError('zarb expr')
1500  if self.expr is None:
1501  log.debug('cannot fromstring int %r', s)
1502  return None, None
1503  return start, stop

+ Here is the call graph for this function:

def miasm2.arch.x86.arch.x86_s08to16.int2expr (   self,
  v 
)

Definition at line 1114 of file arch.py.

1115  def int2expr(self, v):
1116  return self.myexpr(v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def miasm2.arch.x86.arch.x86_s08to16.myexpr (   self,
  x 
)

Definition at line 1111 of file arch.py.

1112  def myexpr(self, x):
1113  return ExprInt16(x)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

miasm2.arch.x86.arch.x86_s08to16.expr

Definition at line 1129 of file arch.py.

int miasm2.arch.x86.arch.x86_s08to16.in_size = 8
static

Definition at line 1108 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.

int miasm2.arch.x86.arch.x86_s08to16.out_size = 16
static

Definition at line 1109 of file arch.py.

miasm2.arch.x86.arch.x86_s08to16.out_size

Definition at line 1144 of file arch.py.

miasm2.arch.x86.arch.x86_imm.parser = base_expr
staticinherited

Definition at line 1035 of file arch.py.

miasm2.arch.x86.arch.x86_s08to16.value

Definition at line 1162 of file arch.py.


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