From e8d0fcf8d28d82a8f33138d044f335634ac3a30c Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Tue, 2 Sep 2014 15:08:26 +0200 Subject: mips sem: fix slt/sltu --- miasm2/arch/mips32/sem.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'miasm2/arch/mips32/sem.py') diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py index d96e6b2d..3d895cda 100644 --- a/miasm2/arch/mips32/sem.py +++ b/miasm2/arch/mips32/sem.py @@ -118,17 +118,14 @@ def mul(ir, instr, a, b, c): e.append(ExprAff(a, ExprOp('imul', b, c))) return None, e, [] -def sltu(ir, instr, a, b, c): +def sltu(ir, instr, a, x, y): e = [] - e.append(ExprAff(a, (b-c).msb().zeroExtend(32))) + e.append(ExprAff(a, (((x - y) ^ ((x ^ y) & ((x - y) ^ x))) ^ x ^ y).msb().zeroExtend(32))) return None, e, [] -def slt(ir, instr, a, b, c): +def slt(ir, instr, a, x, y): e = [] - #nf - of - # TODO CHECK - f = (b-c).msb() ^ (((a ^ c) & (~(a ^ b)))).msb() - e.append(ExprAff(a, f.zeroExtend(32))) + e.append(ExprAff(a, ((x - y) ^ ((x ^ y) & ((x - y) ^ x))).zeroExtend(32))) return None, e, [] def l_sub(ir, instr, a, b, c): -- cgit 1.4.1