summaryrefslogtreecommitdiffstats
path: root/target/s390x
diff options
context:
space:
mode:
authorIlya Leoshkevich2022-08-17 17:05:04 +0200
committerRichard Henderson2022-09-06 09:04:26 +0200
commitab12c95d3f1999648d70bca54ebcc0588a07dd3e (patch)
tree45299ea36740d14226b4cf37d2bb6aedd5b53f4e /target/s390x
parentaccel/tcg: Add fast path for translator_ld* (diff)
downloadqemu-ab12c95d3f1999648d70bca54ebcc0588a07dd3e.tar.gz
qemu-ab12c95d3f1999648d70bca54ebcc0588a07dd3e.tar.xz
qemu-ab12c95d3f1999648d70bca54ebcc0588a07dd3e.zip
target/s390x: Make translator stop before the end of a page
Right now translator stops right *after* the end of a page, which breaks reporting of fault locations when the last instruction of a multi-insn translation block crosses a page boundary. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220817150506.592862-3-iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/s390x')
-rw-r--r--target/s390x/tcg/translate.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index d4c0b9b3a2..1d2dddab1c 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -6609,6 +6609,14 @@ static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
dc->insn_start = tcg_last_op();
}
+static target_ulong get_next_pc(CPUS390XState *env, DisasContext *s,
+ uint64_t pc)
+{
+ uint64_t insn = ld_code2(env, s, pc);
+
+ return pc + get_ilen((insn >> 8) & 0xff);
+}
+
static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
{
CPUS390XState *env = cs->env_ptr;
@@ -6616,10 +6624,9 @@ static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
dc->base.is_jmp = translate_one(env, dc);
if (dc->base.is_jmp == DISAS_NEXT) {
- uint64_t page_start;
-
- page_start = dc->base.pc_first & TARGET_PAGE_MASK;
- if (dc->base.pc_next - page_start >= TARGET_PAGE_SIZE || dc->ex_value) {
+ if (!is_same_page(dcbase, dc->base.pc_next) ||
+ !is_same_page(dcbase, get_next_pc(env, dc, dc->base.pc_next)) ||
+ dc->ex_value) {
dc->base.is_jmp = DISAS_TOO_MANY;
}
}