From: Petar Jovanovic Date: Sun, 20 Jan 2013 18:16:45 +0000 (+0000) Subject: mips: fix for mips-disassembler when branch is at block_size-2 position X-Git-Tag: svn/VALGRIND_3_9_0^2~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99cea0ae07b2ca1f439e1b8617a6cf7a127f19bc;p=thirdparty%2Fvalgrind.git mips: fix for mips-disassembler when branch is at block_size-2 position Check if the last instruction in the block is a branch or jump instruction should happen only if the disassembler was not already stopped. Incorrect conditional led to a boundary case in which jumps/branches were not executed when placed on "max_insns - 2" position in the block. none/tests/mips32/block_size test will be added to Valgrind to describe the case and check for regressions in future. git-svn-id: svn://svn.valgrind.org/vex/trunk@2648 --- diff --git a/VEX/priv/guest_mips_toIR.c b/VEX/priv/guest_mips_toIR.c index f9fb4423a7..c6a458a703 100644 --- a/VEX/priv/guest_mips_toIR.c +++ b/VEX/priv/guest_mips_toIR.c @@ -3622,12 +3622,13 @@ static DisResult disInstr_MIPS_WRK ( Bool(*resteerOkFn) (/*opaque */void *, // On MIPS we need to check if the last instruction // in block is branch or jump - if ((vex_control.guest_max_insns - 1) == (delta+4)/4) + if (((vex_control.guest_max_insns - 1) == (delta + 4) / 4) + && (dres.whatNext != Dis_StopHere)) if (branch_or_jump(guest_code + delta + 4)) { dres.whatNext = Dis_StopHere; dres.jk_StopHere = Ijk_Boring; putPC(mkU32(guest_PC_curr_instr + 4)); - } + } dres.len = 4; DIP("\n");