diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-12-11 14:26:23 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-06-08 17:35:05 +0200 |
| commit | a2637cdf0b40df074865d23a7fd71f082ad7f40a (patch) | |
| tree | f6c958ca8481e6e29760078e5d1bdc2d2b64da53 /miasm2/arch/msp430/sem.py | |
| parent | dadfaabc3fff5edb9bf4ef7e7e8c4cfc4baccb94 (diff) | |
| download | miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.tar.gz miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.zip | |
Expr: Add new word ExprLoc
This word represents a location in the binary. Thus, the hack of ExprId containing an AsmLabel ends here.
Diffstat (limited to 'miasm2/arch/msp430/sem.py')
| -rw-r--r-- | miasm2/arch/msp430/sem.py | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/miasm2/arch/msp430/sem.py b/miasm2/arch/msp430/sem.py index dd24abb1..42f6474e 100644 --- a/miasm2/arch/msp430/sem.py +++ b/miasm2/arch/msp430/sem.py @@ -238,8 +238,11 @@ def push_w(ir, instr, a): def call(ir, instr, a): e, a, dummy = mng_autoinc(a, None, 16) - n = ExprId(ir.get_next_label(instr), 16) - e.append(ExprAff(ExprMem(SP - ExprInt(2, 16), 16), n)) + + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) + + e.append(ExprAff(ExprMem(SP - ExprInt(2, 16), 16), lbl_next_expr)) e.append(ExprAff(SP, SP - ExprInt(2, 16))) e.append(ExprAff(PC, a)) e.append(ExprAff(ir.IRDst, a)) @@ -272,50 +275,56 @@ def cmp_b(ir, instr, a, b): def jz(ir, instr, a): - n = ExprId(ir.get_next_label(instr), 16) + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) e = [] - e.append(ExprAff(PC, ExprCond(zf, a, n))) - e.append(ExprAff(ir.IRDst, ExprCond(zf, a, n))) + e.append(ExprAff(PC, ExprCond(zf, a, lbl_next_expr))) + e.append(ExprAff(ir.IRDst, ExprCond(zf, a, lbl_next_expr))) return e, [] def jnz(ir, instr, a): - n = ExprId(ir.get_next_label(instr), 16) + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) e = [] - e.append(ExprAff(PC, ExprCond(zf, n, a))) - e.append(ExprAff(ir.IRDst, ExprCond(zf, n, a))) + e.append(ExprAff(PC, ExprCond(zf, lbl_next_expr, a))) + e.append(ExprAff(ir.IRDst, ExprCond(zf, lbl_next_expr, a))) return e, [] def jl(ir, instr, a): - n = ExprId(ir.get_next_label(instr), 16) + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) e = [] - e.append(ExprAff(PC, ExprCond(nf ^ of, a, n))) - e.append(ExprAff(ir.IRDst, ExprCond(nf ^ of, a, n))) + e.append(ExprAff(PC, ExprCond(nf ^ of, a, lbl_next_expr))) + e.append(ExprAff(ir.IRDst, ExprCond(nf ^ of, a, lbl_next_expr))) return e, [] def jc(ir, instr, a): - n = ExprId(ir.get_next_label(instr), 16) + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) e = [] - e.append(ExprAff(PC, ExprCond(cf, a, n))) - e.append(ExprAff(ir.IRDst, ExprCond(cf, a, n))) + e.append(ExprAff(PC, ExprCond(cf, a, lbl_next_expr))) + e.append(ExprAff(ir.IRDst, ExprCond(cf, a, lbl_next_expr))) return e, [] def jnc(ir, instr, a): - n = ExprId(ir.get_next_label(instr), 16) + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) e = [] - e.append(ExprAff(PC, ExprCond(cf, n, a))) - e.append(ExprAff(ir.IRDst, ExprCond(cf, n, a))) + e.append(ExprAff(PC, ExprCond(cf, lbl_next_expr, a))) + e.append(ExprAff(ir.IRDst, ExprCond(cf, lbl_next_expr, a))) return e, [] def jge(ir, instr, a): - n = ExprId(ir.get_next_label(instr), 16) + lbl_next = ir.get_next_label(instr) + lbl_next_expr = ExprLoc(lbl_next.loc_key, 16) e = [] - e.append(ExprAff(PC, ExprCond(nf ^ of, n, a))) - e.append(ExprAff(ir.IRDst, ExprCond(nf ^ of, n, a))) + e.append(ExprAff(PC, ExprCond(nf ^ of, lbl_next_expr, a))) + e.append(ExprAff(ir.IRDst, ExprCond(nf ^ of, lbl_next_expr, a))) return e, [] |