|
From: Petar J. <pe...@so...> - 2020-01-14 17:38:34
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3501c118dfb9b4fbd3bd005f30e2cafc65f6fed8 commit 3501c118dfb9b4fbd3bd005f30e2cafc65f6fed8 Author: Petar Jovanovic <mip...@gm...> Date: Tue Jan 14 17:37:21 2020 +0000 mips: Fix BEQC[16] and BNEC[16] instructions for nanoMIPS Instruction decoding was not correct. In some cases, BEQC has been decoded as BNEC and vice versa. It caused problems with musl malloc() function. Patch by Stefan Maksimovic. Diff: --- VEX/priv/guest_nanomips_toIR.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/VEX/priv/guest_nanomips_toIR.c b/VEX/priv/guest_nanomips_toIR.c index f06370f..0cc80b0 100755 --- a/VEX/priv/guest_nanomips_toIR.c +++ b/VEX/priv/guest_nanomips_toIR.c @@ -2201,10 +2201,12 @@ static void nano_p16br(DisResult *dres, UShort cins) putPC(getIReg(rt)); dres->whatNext = Dis_StopHere; } else { - UChar rt = GPR3_list[(cins >> 7) & 0x07]; - UChar rs = GPR3_list[(cins >> 4) & 0x07]; + UChar rt3 = (cins >> 7) & 0x07; + UChar rs3 = (cins >> 4) & 0x07; + UChar rt = GPR3_list[rt3]; + UChar rs = GPR3_list[rs3]; - if (rs < rt) { /* beqc[16] */ + if (rs3 < rt3) { /* beqc[16] */ DIP("beqc r%u, r%u, %X", rt, rs, guest_PC_curr_instr + 2 + u); ir_for_branch(dres, binop(Iop_CmpEQ32, getIReg(rt), getIReg(rs)), 2, (Int)u); |