summaryrefslogtreecommitdiff
path: root/target-mips/translate.c
diff options
context:
space:
mode:
authorLeon Alrae <leon.alrae@imgtec.com>2015-01-26 15:53:16 +0000
committerLeon Alrae <leon.alrae@imgtec.com>2015-02-13 14:11:24 +0000
commitfe2372910a09034591fd2cfc2d70cca43fccaa95 (patch)
treedb43f00067a432b2bca993ecb3f2b80ba89e5efa /target-mips/translate.c
parent196a7958c65778d05a491309377a65c58f643a1c (diff)
downloadqemu-fe2372910a09034591fd2cfc2d70cca43fccaa95.tar.gz
qemu-fe2372910a09034591fd2cfc2d70cca43fccaa95.tar.bz2
qemu-fe2372910a09034591fd2cfc2d70cca43fccaa95.zip
target-mips: fix detection of the end of the page during translation
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 <rth@twiddle.net> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com> Reviewed-by: Maciej W. Rozycki <macro@linux-mips.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-mips/translate.c')
-rw-r--r--target-mips/translate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 881e7fb6d6..a24863c09f 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;