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

Public Member Functions

def __init__
 
def dstflow
 
def get_dst_num
 
def dstflow2label
 
def breakflow
 
def is_subcall
 
def getdstflow
 
def splitflow
 
def get_symbol_size
 
def fixDstOffset
 
def get_args_expr
 

Static Public Member Functions

def arg2str
 

Public Attributes

 name
 

Static Public Attributes

int delayslot = 1
 

Detailed Description

Definition at line 80 of file arch.py.

Constructor & Destructor Documentation

def miasm2.arch.mips32.arch.instruction_mips32.__init__ (   self,
  args,
  kargs 
)

Definition at line 83 of file arch.py.

83 
84  def __init__(self, *args, **kargs):
85  super(instruction_mips32, self).__init__(*args, **kargs)
86 

Member Function Documentation

def miasm2.arch.mips32.arch.instruction_mips32.arg2str (   e,
  pos = None 
)
static

Definition at line 88 of file arch.py.

88 
89  def arg2str(e, pos = None):
90  if isinstance(e, ExprId) or isinstance(e, ExprInt):
91  return str(e)
92  assert(isinstance(e, ExprMem))
93  arg = e.arg
94  if isinstance(arg, ExprId):
95  return "(%s)"%arg
96  assert(len(arg.args) == 2 and arg.op == '+')
97  return "%s(%s)"%(arg.args[1], arg.args[0])

+ Here is the caller graph for this function:

def miasm2.arch.mips32.arch.instruction_mips32.breakflow (   self)

Definition at line 134 of file arch.py.

135  def breakflow(self):
136  if self.name == 'BREAK':
137  return False
138  if self.name in br_0 + br_1 + br_2:
139  return True
140  return False
def miasm2.arch.mips32.arch.instruction_mips32.dstflow (   self)

Definition at line 98 of file arch.py.

98 
99  def dstflow(self):
100  if self.name == 'BREAK':
101  return False
102  if self.name in br_0 + br_1 + br_2:
103  return True
104  return False
def miasm2.arch.mips32.arch.instruction_mips32.dstflow2label (   self,
  symbol_pool 
)

Definition at line 116 of file arch.py.

117  def dstflow2label(self, symbol_pool):
118  if self.name in ["J", 'JAL']:
119  e = self.args[0].arg
120  ad = (self.offset & (0xFFFFFFFF ^ ((1<< 28)-1))) + e
121  l = symbol_pool.getby_offset_create(ad)
122  self.args[0] = ExprId(l, e.size)
123  return
124 
125  ndx = self.get_dst_num()
126  e = self.args[ndx]
127 
128  if not isinstance(e, ExprInt):
129  return
130  ad = e.arg + self.offset
131  l = symbol_pool.getby_offset_create(ad)
132  s = ExprId(l, e.size)
133  self.args[ndx] = s

+ Here is the call graph for this function:

def miasm2.arch.mips32.arch.instruction_mips32.fixDstOffset (   self)

Definition at line 174 of file arch.py.

175  def fixDstOffset(self):
176  ndx = self.get_dst_num()
177  e = self.args[ndx]
178  if self.offset is None:
179  raise ValueError('symbol not resolved %s' % self.l)
180  if not isinstance(e, ExprInt):
181  return
182  off = e.arg - self.offset
183  if int(off % 4):
184  raise ValueError('strange offset! %r' % off)
185  self.args[ndx] = ExprInt32(off)

+ Here is the call graph for this function:

def miasm2.arch.mips32.arch.instruction_mips32.get_args_expr (   self)

Definition at line 186 of file arch.py.

187  def get_args_expr(self):
188  args = [a for a in self.args]
189  return args
190 
def miasm2.arch.mips32.arch.instruction_mips32.get_dst_num (   self)

Definition at line 105 of file arch.py.

106  def get_dst_num(self):
107  if self.name in br_0:
108  i = 0
109  elif self.name in br_1:
110  i = 1
111  elif self.name in br_2:
112  i = 2
113  else:
114  raise NotImplementedError("TODO %s"%self)
115  return i

+ Here is the caller graph for this function:

def miasm2.arch.mips32.arch.instruction_mips32.get_symbol_size (   self,
  symbol,
  symbol_pool 
)

Definition at line 171 of file arch.py.

172  def get_symbol_size(self, symbol, symbol_pool):
173  return 32

+ Here is the caller graph for this function:

def miasm2.arch.mips32.arch.instruction_mips32.getdstflow (   self,
  symbol_pool 
)

Definition at line 146 of file arch.py.

147  def getdstflow(self, symbol_pool):
148  if self.name in br_0:
149  return [self.args[0]]
150  elif self.name in br_1:
151  return [self.args[1]]
152  elif self.name in br_2:
153  return [self.args[2]]
154  elif self.name in ['JAL', 'JALR', 'JR', 'J']:
155  return [self.args[0]]
156  else:
157  raise NotImplementedError("fix mnemo %s"%self.name)

+ Here is the caller graph for this function:

def miasm2.arch.mips32.arch.instruction_mips32.is_subcall (   self)

Definition at line 141 of file arch.py.

142  def is_subcall(self):
143  if self.name in ['JAL', 'JALR', 'BAL']:
144  return True
145  return False
def miasm2.arch.mips32.arch.instruction_mips32.splitflow (   self)

Definition at line 158 of file arch.py.

159  def splitflow(self):
160  if self.name in ["B", 'JR', 'J']:
161  return False
162  if self.name in br_0:
163  return True
164  if self.name in br_1:
165  return True
166  if self.name in br_2:
167  return True
168  if self.name in ['JAL', 'JALR']:
169  return True
170  return False

Member Data Documentation

int miasm2.arch.mips32.arch.instruction_mips32.delayslot = 1
static

Definition at line 81 of file arch.py.

miasm2.arch.mips32.arch.instruction_mips32.name

Definition at line 99 of file arch.py.


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