diff options
Diffstat (limited to 'miasm2/arch/mips32/arch.py')
| -rw-r--r-- | miasm2/arch/mips32/arch.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py index 50dc1c86..60b0f5d2 100644 --- a/miasm2/arch/mips32/arch.py +++ b/miasm2/arch/mips32/arch.py @@ -10,7 +10,7 @@ from miasm2.expression.expression import ExprMem, ExprInt, ExprInt32, ExprId from miasm2.core.bin_stream import bin_stream import miasm2.arch.mips32.regs as regs import miasm2.core.cpu as cpu - +from miasm2.core.asmbloc import asm_label log = logging.getLogger("mips32dis") console_handler = logging.StreamHandler() @@ -48,6 +48,26 @@ deref_nooff = Group(LPARENTHESIS + gpregs.parser + \ deref = deref_off | deref_nooff +variable, operand, base_expr = cpu.gen_base_expr() + +int_or_expr = base_expr + + +def ast_id2expr(t): + if not t in mn_mips32.regs.all_regs_ids_byname: + r = ExprId(asm_label(t)) + else: + r = mn_mips32.regs.all_regs_ids_byname[t] + return r + + +def ast_int2expr(a): + return ExprInt32(a) + + +my_var_parser = cpu.parse_ast(ast_id2expr, ast_int2expr) +base_expr.setParseAction(my_var_parser) + class additional_info: def __init__(self): self.except_on_instr = False |