diff options
| -rw-r--r-- | miasm2/arch/aarch64/arch.py | 4 | ||||
| -rw-r--r-- | miasm2/arch/arm/arch.py | 4 | ||||
| -rw-r--r-- | miasm2/arch/sh4/arch.py | 8 | ||||
| -rw-r--r-- | miasm2/arch/x86/arch.py | 47 | ||||
| -rw-r--r-- | miasm2/core/cpu.py | 24 |
5 files changed, 43 insertions, 44 deletions
diff --git a/miasm2/arch/aarch64/arch.py b/miasm2/arch/aarch64/arch.py index 2712e60a..c47d15d4 100644 --- a/miasm2/arch/aarch64/arch.py +++ b/miasm2/arch/aarch64/arch.py @@ -829,8 +829,8 @@ def set_imm_to_size(size, expr): class aarch64_imm_sf(imm_noarg): parser = base_expr - def fromstring(self, s, parser_result=None): - start, stop = super(aarch64_imm_sf, self).fromstring(s, parser_result) + def fromstring(self, text, parser_result=None): + start, stop = super(aarch64_imm_sf, self).fromstring(text, parser_result) if start is None: return start, stop size = self.parent.args[0].expr.size diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py index f4ea36a6..b607b6c2 100644 --- a/miasm2/arch/arm/arch.py +++ b/miasm2/arch/arm/arch.py @@ -2798,8 +2798,8 @@ class armt_aif(reg_noarg, m_arg): return ret return self.value != 0 - def fromstring(self, s, parser_result=None): - start, stop = super(armt_aif, self).fromstring(s, parser_result) + def fromstring(self, text, parser_result=None): + start, stop = super(armt_aif, self).fromstring(text, parser_result) if self.expr.name == "X": return None, None return start, stop diff --git a/miasm2/arch/sh4/arch.py b/miasm2/arch/sh4/arch.py index ecfc9502..6d43bd3e 100644 --- a/miasm2/arch/sh4/arch.py +++ b/miasm2/arch/sh4/arch.py @@ -149,8 +149,8 @@ class sh4_freg(sh4_reg): class sh4_dgpreg(m_arg): parser = dgpregs_base - def fromstring(self, s, parser_result=None): - start, stop = super(sh4_dgpreg, self).fromstring(s, parser_result) + def fromstring(self, text, parser_result=None): + start, stop = super(sh4_dgpreg, self).fromstring(text, parser_result) if start is None: return start, stop self.expr = ExprMem(self.expr.arg, self.sz) @@ -175,8 +175,8 @@ class sh4_dgpreg(m_arg): class sh4_dgpregpinc(m_arg): parser = dgpregs_p - def fromstring(self, s, parser_result=None): - start, stop = super(sh4_dgpregpinc, self).fromstring(s, parser_result) + def fromstring(self, text, parser_result=None): + start, stop = super(sh4_dgpregpinc, self).fromstring(text, parser_result) if self.expr is None: return None, None if not isinstance(self.expr.arg, ExprOp): diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index be3dbd94..34a765e8 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -685,19 +685,19 @@ class mn_x86(cls_mn): return [(subcls, name, bases, dct, fields)] @classmethod - def fromstring(cls, s, mode): + def fromstring(cls, text, mode): pref = 0 - prefix, new_s = get_prefix(s) + prefix, new_s = get_prefix(text) if prefix == "LOCK": pref |= 1 - s = new_s + text = new_s elif prefix == "REPNE": pref |= 2 - s = new_s + text = new_s elif prefix == "REPE": pref |= 4 - s = new_s - c = super(mn_x86, cls).fromstring(s, mode) + text = new_s + c = super(mn_x86, cls).fromstring(text, mode) c.additional_info.g1.value = pref return c @@ -1937,12 +1937,11 @@ def modrm2expr(modrm, parent, w8, sx=0, xmm=0, mm=0, bnd=0): class x86_rm_arg(m_arg): parser = rmarg - def fromstring(self, s, parser_result=None): - start, stop = super(x86_rm_arg, self).fromstring(s, parser_result) + def fromstring(self, text, parser_result=None): + start, stop = super(x86_rm_arg, self).fromstring(text, parser_result) p = self.parent if start is None: return None, None - s = self.expr.size return start, stop def get_modrm(self): @@ -2074,9 +2073,9 @@ class x86_rm_arg(m_arg): yield x class x86_rm_mem(x86_rm_arg): - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): self.expr = None - start, stop = super(x86_rm_mem, self).fromstring(s, parser_result) + start, stop = super(x86_rm_mem, self).fromstring(text, parser_result) if not isinstance(self.expr, ExprMem): return None, None return start, stop @@ -2084,9 +2083,9 @@ class x86_rm_mem(x86_rm_arg): class x86_rm_mem_far(x86_rm_arg): parser = mem_far - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): self.expr = None - start, stop = super(x86_rm_mem_far, self).fromstring(s, parser_result) + start, stop = super(x86_rm_mem_far, self).fromstring(text, parser_result) if not isinstance(self.expr, ExprMem): return None, None self.expr = ExprOp('far', self.expr) @@ -2456,7 +2455,7 @@ class x86_rm_reg_noarg(object): parser = gpreg - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): if not hasattr(self.parent, 'sx') and hasattr(self.parent, "w8"): self.parent.w8.value = 1 if parser_result: @@ -2470,7 +2469,7 @@ class x86_rm_reg_noarg(object): self.parent.w8.value = 0 return start, stop try: - v, start, stop = self.parser.scanString(s).next() + v, start, stop = self.parser.scanString(text).next() except StopIteration: return None, None self.expr = v[0] @@ -2756,12 +2755,12 @@ class bs_cond_imm(bs_cond_scale, m_arg): parser = int_or_expr max_size = 32 - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): if parser_result: expr, start, stop = parser_result[self.parser] else: try: - expr, start, stop = self.parser.scanString(s).next() + expr, start, stop = self.parser.scanString(text).next() except StopIteration: expr = None self.expr = expr @@ -2776,7 +2775,7 @@ class bs_cond_imm(bs_cond_scale, m_arg): self.expr = ExprInt(v & mask, l) if self.expr is None: - log.debug('cannot fromstring int %r', s) + log.debug('cannot fromstring int %r', text) return None, None return start, stop @@ -2883,12 +2882,12 @@ class bs_cond_imm64(bs_cond_imm): class bs_rel_off(bs_cond_imm): parser = int_or_expr - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): if parser_result: expr, start, stop = parser_result[self.parser] else: try: - expr, start, stop = self.parser.scanString(s).next() + expr, start, stop = self.parser.scanString(text).next() except StopIteration: expr = None self.expr = expr @@ -3037,14 +3036,14 @@ class bs_movoff(m_arg): return None, None return start, stop try: - v, start, stop = self.parser.scanString(s).next() + v, start, stop = self.parser.scanString(text).next() except StopIteration: return None, None if not isinstance(e, ExprMem): return None, None self.expr = v[0] if self.expr is None: - log.debug('cannot fromstring int %r', s) + log.debug('cannot fromstring int %r', text) return None, None return start, stop @@ -3102,12 +3101,12 @@ class bs_msegoff(m_arg): return None, None return start, stop try: - v, start, stop = self.parser.scanString(s).next() + v, start, stop = self.parser.scanString(text).next() except StopIteration: return None, None self.expr = v[0] if self.expr is None: - log.debug('cannot fromstring int %r', s) + log.debug('cannot fromstring int %r', text) return None, None return start, stop diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index 57057a85..061752f8 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -656,13 +656,13 @@ class bs_swapargs(bs_divert): class m_arg(object): - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): if parser_result: e, start, stop = parser_result[self.parser] self.expr = e return start, stop try: - v, start, stop = self.parser.scanString(s).next() + v, start, stop = self.parser.scanString(text).next() except StopIteration: return None, None self.expr = v[0] @@ -688,13 +688,13 @@ class reg_noarg(object): reg_info = None parser = None - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): if parser_result: e, start, stop = parser_result[self.parser] self.expr = e return start, stop try: - v, start, stop = self.parser.scanString(s).next() + v, start, stop = self.parser.scanString(text).next() except StopIteration: return None, None self.expr = v[0] @@ -1252,11 +1252,11 @@ class cls_mn(object): return out[0] @classmethod - def fromstring(cls, s, mode = None): + def fromstring(cls, text, mode = None): global total_scans - name = re.search('(\S+)', s).groups() + name = re.search('(\S+)', text).groups() if not name: - raise ValueError('cannot find name', s) + raise ValueError('cannot find name', text) name = name[0] if not name in cls.all_mn_name: @@ -1269,7 +1269,7 @@ class cls_mn(object): for cc in clist: for c in cls.get_cls_instance(cc, mode): args_expr = [] - args_str = s[len(name):].strip(' ') + args_str = text[len(name):].strip(' ') start = 0 cannot_parse = False @@ -1316,7 +1316,7 @@ class cls_mn(object): break if len(out) == 0: - raise ValueError('cannot fromstring %r' % s) + raise ValueError('cannot fromstring %r' % text) if len(out) != 1: log.debug('fromstring multiple args ret default') c = out[0] @@ -1532,12 +1532,12 @@ class imm_noarg(object): return None return v - def fromstring(self, s, parser_result=None): + def fromstring(self, text, parser_result=None): if parser_result: e, start, stop = parser_result[self.parser] else: try: - e, start, stop = self.parser.scanString(s).next() + e, start, stop = self.parser.scanString(text).next() except StopIteration: return None, None if e is None: @@ -1551,7 +1551,7 @@ class imm_noarg(object): else: raise TypeError('zarb expr') if self.expr is None: - log.debug('cannot fromstring int %r', s) + log.debug('cannot fromstring int %r', text) return None, None return start, stop |