qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org
Subject: [PATCH v1 12/26] target/s390x: Move masking of psw.addr to cpu_get_tb_cpu_state
Date: Tue,  6 Sep 2022 11:17:33 +0100	[thread overview]
Message-ID: <20220906101747.344559-13-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220906101747.344559-1-richard.henderson@linaro.org>

Masking after the fact in s390x_tr_init_disas_context
provides incorrect information to tb_lookup.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/s390x/cpu.h           | 13 +++++++------
 target/s390x/tcg/translate.c |  6 ------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 7d6d01325b..b5c99bc694 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -379,17 +379,18 @@ static inline int cpu_mmu_index(CPUS390XState *env, bool ifetch)
 }
 
 static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc,
-                                        target_ulong *cs_base, uint32_t *flags)
+                                        target_ulong *cs_base, uint32_t *pflags)
 {
-    *pc = env->psw.addr;
-    *cs_base = env->ex_value;
-    *flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;
+    int flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;
     if (env->cregs[0] & CR0_AFP) {
-        *flags |= FLAG_MASK_AFP;
+        flags |= FLAG_MASK_AFP;
     }
     if (env->cregs[0] & CR0_VECTOR) {
-        *flags |= FLAG_MASK_VECTOR;
+        flags |= FLAG_MASK_VECTOR;
     }
+    *pflags = flags;
+    *cs_base = env->ex_value;
+    *pc = (flags & FLAG_MASK_64 ? env->psw.addr : env->psw.addr & 0x7fffffff);
 }
 
 /* PER bits from control register 9 */
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 67c86996e9..9ee8146b87 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -6485,12 +6485,6 @@ static void s390x_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
 {
     DisasContext *dc = container_of(dcbase, DisasContext, base);
 
-    /* 31-bit mode */
-    if (!(dc->base.tb->flags & FLAG_MASK_64)) {
-        dc->base.pc_first &= 0x7fffffff;
-        dc->base.pc_next = dc->base.pc_first;
-    }
-
     dc->cc_op = CC_OP_DYNAMIC;
     dc->ex_value = dc->base.tb->cs_base;
     dc->exit_to_mainloop = (dc->base.tb->flags & FLAG_MASK_PER) || dc->ex_value;
-- 
2.34.1



  parent reply	other threads:[~2022-09-06 11:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 10:17 [PATCH v1 00/26] target/s390x: pc-relative translation Richard Henderson
2022-09-06 10:17 ` [PATCH v1 01/26] target/s390x: Use tcg_constant_* in local contexts Richard Henderson
2022-09-06 14:26   ` Philippe Mathieu-Daudé via
2022-09-06 10:17 ` [PATCH v1 02/26] target/s390x: Use tcg_constant_* for DisasCompare Richard Henderson
2022-09-06 10:17 ` [PATCH v1 03/26] target/s390x: Use tcg_constant_i32 for fpinst_extract_m34 Richard Henderson
2022-09-06 10:17 ` [PATCH v1 04/26] target/s390x: Use tcg_constant_* in translate_vx.c.inc Richard Henderson
2022-09-06 10:17 ` [PATCH v1 05/26] target/s390x: Change help_goto_direct to work on displacements Richard Henderson
2022-09-06 10:17 ` [PATCH v1 06/26] target/s390x: Introduce gen_psw_addr_disp Richard Henderson
2022-09-06 10:17 ` [PATCH v1 07/26] target/s390x: Remove pc argument to pc_to_link_into Richard Henderson
2022-09-06 14:28   ` Philippe Mathieu-Daudé via
2022-09-06 10:17 ` [PATCH v1 08/26] target/s390x: Use gen_psw_addr_disp in pc_to_link_info Richard Henderson
2022-09-06 10:17 ` [PATCH v1 09/26] target/s390x: Use gen_psw_addr_disp in save_link_info Richard Henderson
2022-09-06 14:31   ` Philippe Mathieu-Daudé via
2022-09-06 10:17 ` [PATCH v1 10/26] target/s390x: Use gen_psw_addr_disp in op_sam Richard Henderson
2022-09-06 10:17 ` [PATCH v1 11/26] target/s390x: Use ilen instead in branches Richard Henderson
2022-09-06 10:17 ` Richard Henderson [this message]
2022-09-06 10:17 ` [PATCH v1 13/26] target/s390x: Add disp argument to update_psw_addr Richard Henderson
2022-09-06 10:17 ` [PATCH v1 14/26] target/s390x: Don't set gbea for user-only Richard Henderson
2022-09-06 10:17 ` [PATCH v1 15/26] target/s390x: Introduce per_enabled Richard Henderson
2022-09-06 10:17 ` [PATCH v1 16/26] target/s390x: Disable conditional branch-to-next for PER Richard Henderson
2022-09-06 10:17 ` [PATCH v1 17/26] target/s390x: Introduce help_goto_indirect Richard Henderson
2022-09-06 10:17 ` [PATCH v1 18/26] target/s390x: Split per_branch Richard Henderson
2022-09-06 10:17 ` [PATCH v1 19/26] target/s390x: Simplify help_branch Richard Henderson
2022-09-06 10:17 ` [PATCH v1 20/26] target/s390x: Split per_breaking_event from per_branch_* Richard Henderson
2022-09-06 10:17 ` [PATCH v1 21/26] target/s390x: Remove PER check from use_goto_tb Richard Henderson
2022-09-06 10:17 ` [PATCH v1 22/26] target/s390x: Pass original r2 register to BCR Richard Henderson
2022-09-06 10:17 ` [PATCH v1 23/26] tcg: Pass TCGTempKind to tcg_temp_new_internal Richard Henderson
2022-09-06 14:34   ` Philippe Mathieu-Daudé via
2022-09-06 10:17 ` [PATCH v1 24/26] tcg: Introduce tcg_temp_ebb_new_* Richard Henderson
2022-09-06 10:17 ` [PATCH v1 25/26] tcg: Introduce tcg_temp_is_normal_* Richard Henderson
2022-09-06 14:33   ` Philippe Mathieu-Daudé via
2022-09-06 10:17 ` [PATCH v1 26/26] target/s390x: Enable TARGET_TB_PCREL Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220906101747.344559-13-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).