Ejemplo n.º 1
0
 def binptr_m_symb(self, s):
     if ',' in s: return None
     items = s.split('(')
     offset = items[0]
     if offset[0] != '-': return None
     reg = self.reg_symb(items[1][:-1])
     return None if reg is None else Types.BinOP_MINUS(
         (reg, int(offset[1:], 16)))
Ejemplo n.º 2
0
 def binptr_m_symb(self, s):
     """
     Parse addressing with register minus offset: -0x10(%rax)
     :param s: lexeme
     """
     if ',' in s or ':' in s: return None
     items = s.split('(')
     offset = items[0]
     if offset[0] != '-': return None
     reg = self.reg_symb(items[1][:-1])
     return None if reg is None else Types.BinOP_MINUS((reg, int(offset[1:], 16)))
Ejemplo n.º 3
0
 def binptr_symb(self, sym):
     """
     Parse addressing with register and offset: [r1, #0x10]
     :param s: lexeme
     """
     preind = sym[-1] == '!'
     items = sym[1:(-2 if preind else -1)].split(',')
     if len(items) == 2 and items[1][0] == '#':
         off = int(items[1][1:], 16)
         return Types.BinOP_PLUS((self.reg_symb(items[0]), off), preind) if off >= 0 else \
                Types.BinOP_MINUS((self.reg_symb(items[0]), -off), preind)
     return None