diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2018-05-11 22:02:49 -0700 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-06-11 12:43:42 +0200 |
commit | 4c7a0f6f34869b3dfe7091d28ff27a8dfbdd8b70 (patch) | |
tree | f779182e3805415456888bb8ba64b3e7d8c7c204 /target/m68k/translate.c | |
parent | 11ab74b01e0a8ea4973eed89c6b90fa6e4fb9fb6 (diff) | |
download | qemu-4c7a0f6f34869b3dfe7091d28ff27a8dfbdd8b70.zip qemu-4c7a0f6f34869b3dfe7091d28ff27a8dfbdd8b70.tar.gz qemu-4c7a0f6f34869b3dfe7091d28ff27a8dfbdd8b70.tar.bz2 |
target/m68k: Improve ending TB at page boundaries
Rather than limit total TB size to PAGE-32 bytes, end the TB when
near the end of a page. This should provide proper semantics of
SIGSEGV when executing near the end of a page.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180512050250.12774-9-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'target/m68k/translate.c')
-rw-r--r-- | target/m68k/translate.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 62a96be..ff3493d 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -6105,9 +6105,25 @@ static void m68k_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) disas_m68k_insn(cpu->env_ptr, dc); dc->base.pc_next = dc->pc; - if (dc->base.is_jmp == DISAS_NEXT - && dc->pc - dc->base.pc_first >= TARGET_PAGE_SIZE - 32) { - dc->base.is_jmp = DISAS_TOO_MANY; + if (dc->base.is_jmp == DISAS_NEXT) { + /* Stop translation when the next insn might touch a new page. + * This ensures that prefetch aborts at the right place. + * + * We cannot determine the size of the next insn without + * completely decoding it. However, the maximum insn size + * is 32 bytes, so end if we do not have that much remaining. + * This may produce several small TBs at the end of each page, + * but they will all be linked with goto_tb. + * + * ??? ColdFire maximum is 4 bytes; MC68000's maximum is also + * smaller than MC68020's. + */ + target_ulong start_page_offset + = dc->pc - (dc->base.pc_first & TARGET_PAGE_MASK); + + if (start_page_offset >= TARGET_PAGE_SIZE - 32) { + dc->base.is_jmp = DISAS_TOO_MANY; + } } } |