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

Public Member Functions

def fromstring
 
def getrexsize
 
def setrexsize
 
def decode
 
def encode
 

Public Attributes

 expr
 
 value
 

Static Public Attributes

int prio = default_prio+1
 
 parser = gpreg
 

Detailed Description

Definition at line 2272 of file arch.py.

Member Function Documentation

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

Definition at line 2308 of file arch.py.

2309  def decode(self, v):
2310  v = v & self.lmask
2311  p = self.parent
2312  opmode = p.v_opmode()
2313  if not hasattr(p, 'sx') and (hasattr(p, 'w8') and p.w8.value == 0):
2314  opmode = 8
2315  r = size2gpregs[opmode]
2316  if p.mode == 64 and self.getrexsize():
2317  v |= 0x8
2318  if p.v_opmode() == 64 or p.rex_p.value == 1:
2319  if not hasattr(p, 'sx') and (hasattr(p, 'w8') and p.w8.value == 0):
2320  r = gpregs08_64
2321  self.expr = r.expr[v]
2322  return True

+ Here is the call graph for this function:

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

Definition at line 2323 of file arch.py.

2324  def encode(self):
2325  if not isinstance(self.expr, ExprId):
2326  return False
2327  if self.expr in gpregs64.expr and not hasattr(self.parent, 'stk'):
2328  self.parent.rex_w.value = 1
2329  opmode = self.parent.v_opmode()
2330  if not hasattr(self.parent, 'sx') and hasattr(self.parent, 'w8'):
2331  self.parent.w8.value = 1
2332  if self.expr.size == 8:
2333  if hasattr(self.parent, 'sx') or not hasattr(self.parent, 'w8'):
2334  return False
2335  self.parent.w8.value = 0
2336  opmode = 8
2337  r = size2gpregs[opmode]
2338  if self.expr in r.expr:
2339  i = r.expr.index(self.expr)
2340  elif (opmode == 8 and self.parent.mode == 64 and
2341  self.expr in gpregs08_64.expr):
2342  i = gpregs08_64.expr.index(self.expr)
2343  self.parent.rex_p.value = 1
2344  else:
2345  log.debug("cannot encode reg %r", self.expr)
2346  return False
2347  if self.parent.v_opmode() == 64:
2348  if i > 7:
2349  self.setrexsize(1)
2350  i -= 8
2351  elif self.parent.mode == 64 and i > 7:
2352  i -= 8
2353  self.setrexsize(1)
2354  self.value = i
2355  if self.value > self.lmask:
2356  log.debug("cannot encode field value %x %x",
2357  self.value, self.lmask)
2358  return False
2359  return True
2360 

+ Here is the call graph for this function:

def miasm2.arch.x86.arch.x86_rm_reg_noarg.fromstring (   self,
  s,
  parser_result = None 
)

Definition at line 2277 of file arch.py.

2278  def fromstring(self, s, parser_result=None):
2279  if not hasattr(self.parent, 'sx') and hasattr(self.parent, "w8"):
2280  self.parent.w8.value = 1
2281  if parser_result:
2282  e, start, stop = parser_result[self.parser]
2283  if e is None:
2284  return None, None
2285  self.expr = e
2286  if self.expr.size == 8:
2287  if hasattr(self.parent, 'sx') or not hasattr(self.parent, 'w8'):
2288  return None, None
2289  self.parent.w8.value = 0
2290  return start, stop
2291  try:
2292  v, start, stop = self.parser.scanString(s).next()
2293  except StopIteration:
2294  return None, None
2295  self.expr = v[0]
2296  if self.expr.size == 0:
2297  if hasattr(self.parent, 'sx') or not hasattr(self.parent, 'w8'):
2298  return None, None
2299  self.parent.w8.value = 0
2300 
2301  return start, stop
def miasm2.arch.x86.arch.x86_rm_reg_noarg.getrexsize (   self)

Definition at line 2302 of file arch.py.

2303  def getrexsize(self):
2304  return self.parent.rex_r.value

+ Here is the caller graph for this function:

def miasm2.arch.x86.arch.x86_rm_reg_noarg.setrexsize (   self,
  v 
)

Definition at line 2305 of file arch.py.

2306  def setrexsize(self, v):
2307  self.parent.rex_r.value = v

+ Here is the caller graph for this function:

Member Data Documentation

miasm2.arch.x86.arch.x86_rm_reg_noarg.expr

Definition at line 2284 of file arch.py.

miasm2.arch.x86.arch.x86_rm_reg_noarg.parser = gpreg
static

Definition at line 2275 of file arch.py.

int miasm2.arch.x86.arch.x86_rm_reg_noarg.prio = default_prio+1
static

Definition at line 2273 of file arch.py.

miasm2.arch.x86.arch.x86_rm_reg_noarg.value

Definition at line 2353 of file arch.py.


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