From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMgmc-0005jQ-7l for qemu-devel@nongnu.org; Sat, 14 Feb 2015 12:45:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMgma-0005IM-IY for qemu-devel@nongnu.org; Sat, 14 Feb 2015 12:45:34 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:10214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMgma-0005I8-CU for qemu-devel@nongnu.org; Sat, 14 Feb 2015 12:45:32 -0500 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id D424A2737B8EA for ; Sat, 14 Feb 2015 17:45:27 +0000 (GMT) From: Leon Alrae Date: Sat, 14 Feb 2015 17:44:59 +0000 Message-ID: <1423935904-29405-10-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1423935904-29405-1-git-send-email-leon.alrae@imgtec.com> References: <1423935904-29405-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PULL v2 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 881e7fb..a24863c 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; CPUBreakpoint *bp; int j, lj = -1; int num_insns; @@ -19106,6 +19107,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; ctx.pc = pc_start; ctx.saved_pc = -1; ctx.singlestep_enabled = cs->singlestep_enabled; @@ -19204,8 +19206,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_op_buf_full()) { break; -- 2.1.0