Received: from eggs.gnu.org ([2001:4830:134:3::10]:55888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMD5o-0004ds-Ed for qemu-devel@nongnu.org; Fri, 13 Feb 2015 05:03:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMD5g-0007d7-Dg for qemu-devel@nongnu.org; Fri, 13 Feb 2015 05:03:24 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:34123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMD5g-0007d2-7r for qemu-devel@nongnu.org; Fri, 13 Feb 2015 05:03:16 -0500 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id AB77E3FA19890 for ; Fri, 13 Feb 2015 10:03:13 +0000 (GMT) From: Leon Alrae Date: Fri, 13 Feb 2015 10:02:07 +0000 Message-ID: <1423821732-22542-10-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1423821732-22542-1-git-send-email-leon.alrae@imgtec.com> References: <1423821732-22542-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PULL 09/14] target-mips: fix detection of the end of the page during translation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The test is supposed to terminate TB if the end of the page is reached. However, with current implementation it may never succeed for microMIPS or mips16. Reported-by: Richard Henderson Signed-off-by: Leon Alrae Reviewed-by: Maciej W. Rozycki Reviewed-by: Richard Henderson --- target-mips/translate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target-mips/translate.c b/target-mips/translate.c index 1faeb5d..205a433 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -19095,6 +19095,7 @@ gen_intermediate_code_internal(MIPSCPU *cpu, TranslationBlock *tb, CPUMIPSState *env = &cpu->env; DisasContext ctx; target_ulong pc_start; + target_ulong next_page_start; uint16_t *gen_opc_end; CPUBreakpoint *bp; int j, lj = -1; @@ -19107,6 +19108,7 @@ gen_intermediate_code_internal(MIPSCPU *cpu, TranslationBlock *tb, qemu_log("search pc %d\n", search_pc); pc_start = tb->pc; + next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.pc = pc_start; ctx.saved_pc = -1; @@ -19206,8 +19208,9 @@ gen_intermediate_code_internal(MIPSCPU *cpu, TranslationBlock *tb, break; } - if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) + if (ctx.pc >= next_page_start) { break; + } if (tcg_ctx.gen_opc_ptr >= gen_opc_end) { break; -- 2.1.0