diff options
| author | Guillaume Valadon <guillaume.valadon@netatmo.com> | 2018-11-22 12:16:36 +0100 |
|---|---|---|
| committer | Guillaume Valadon <guillaume.valadon@netatmo.com> | 2018-11-22 12:16:36 +0100 |
| commit | 363fa05f82e8326ef91b30f6b3b1a13d37e517cd (patch) | |
| tree | 707facd277aae33026fb5e7c4ec6d0fddff84c46 /miasm2/arch/mep/sem.py | |
| parent | ba4071553ea2e44ce87f58a9377dcc1d29bd81a1 (diff) | |
| download | miasm-363fa05f82e8326ef91b30f6b3b1a13d37e517cd.tar.gz miasm-363fa05f82e8326ef91b30f6b3b1a13d37e517cd.zip | |
Correct MeP BGEI semantic
Diffstat (limited to 'miasm2/arch/mep/sem.py')
| -rw-r--r-- | miasm2/arch/mep/sem.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/miasm2/arch/mep/sem.py b/miasm2/arch/mep/sem.py index 59960fe9..9e0cba6b 100644 --- a/miasm2/arch/mep/sem.py +++ b/miasm2/arch/mep/sem.py @@ -7,7 +7,7 @@ from miasm2.arch.mep.arch import mn_mep from miasm2.arch.mep.regs import PC, SP, LP, SAR, TP, RPB, RPE, RPC, EPC, NPC, \ take_jmp, in_erepeat from miasm2.arch.mep.regs import EXC, HI, LO, PSW, DEPC, DBG -from miasm2.expression.expression import ExprId, ExprInt, ExprOp +from miasm2.expression.expression import ExprId, ExprInt, ExprOp, TOK_EQUAL from miasm2.expression.expression import ExprAssign, ExprCond, ExprMem from miasm2.core.cpu import sign_ext from miasm2.jitter.csts import EXCEPT_DIV_BY_ZERO @@ -549,8 +549,9 @@ def bgei(reg_test, imm4, disp16): """BGEI - Branch if the register is greater or equal to imm4.""" # if(Rn>=ZeroExt(imm4)) PC <- PC +SignExt((disp17)16..1||0) - (Signed comparison) - dst = disp16 if ">="(reg_test, imm4) else ExprLoc(ir.get_next_break_loc_key(instr), 32) - take_jmp = ExprInt(1, 32) if ">="(reg_test, imm4) else ExprInt(0, 32) + cond = i32(1) if ExprOp(TOK_EQUAL, reg_test, imm4) else compute_s_inf(imm4, reg_test).zeroExtend(32) + dst = disp16 if cond else ExprLoc(ir.get_next_break_loc_key(instr), 32) + take_jmp = ExprInt(1, 32) if cond else ExprInt(0, 32) PC = dst ir.IRDst = dst |