All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: david@redhat.com
Subject: [Qemu-devel] [PATCH 2/4] target/s390x: Use ILEN_UNWIND in trivial cases
Date: Mon, 24 Jul 2017 19:36:09 -0700	[thread overview]
Message-ID: <20170725023611.9169-3-rth@twiddle.net> (raw)
In-Reply-To: <20170725023611.9169-1-rth@twiddle.net>

All of these uses also have an immediately visible
call to cpu_restore_state.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target/s390x/helper.c      |  7 +++----
 target/s390x/mem_helper.c  | 26 +++++++++++++-------------
 target/s390x/misc_helper.c |  2 +-
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index 6d67d6b5a1..c83772bec3 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -763,9 +763,8 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
     S390CPU *cpu = S390_CPU(cs);
     CPUS390XState *env = &cpu->env;
 
-    if (retaddr) {
-        cpu_restore_state(cs, retaddr);
-    }
-    program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO);
+    g_assert(retaddr != 0);
+    cpu_restore_state(cs, retaddr);
+    program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND);
 }
 #endif /* CONFIG_USER_ONLY */
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index cdc78aa3d4..026189aefd 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -75,7 +75,7 @@ static inline void check_alignment(CPUS390XState *env, uint64_t v,
     if (v % wordsize) {
         CPUState *cs = CPU(s390_env_get_cpu(env));
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_SPECIFICATION, 6);
+        program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND);
     }
 }
 
@@ -548,7 +548,7 @@ void HELPER(srst)(CPUS390XState *env, uint32_t r1, uint32_t r2)
     /* Bits 32-55 must contain all 0.  */
     if (env->regs[0] & 0xffffff00u) {
         cpu_restore_state(ENV_GET_CPU(env), ra);
-        program_interrupt(env, PGM_SPECIFICATION, 6);
+        program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND);
     }
 
     str = get_address(env, r2);
@@ -586,7 +586,7 @@ void HELPER(srstu)(CPUS390XState *env, uint32_t r1, uint32_t r2)
     /* Bits 32-47 of R0 must be zero.  */
     if (env->regs[0] & 0xffff0000u) {
         cpu_restore_state(ENV_GET_CPU(env), ra);
-        program_interrupt(env, PGM_SPECIFICATION, 6);
+        program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND);
     }
 
     str = get_address(env, r2);
@@ -1589,7 +1589,7 @@ uint32_t HELPER(csst)(CPUS390XState *env, uint32_t r3, uint64_t a1, uint64_t a2)
 
  spec_exception:
     cpu_restore_state(ENV_GET_CPU(env), ra);
-    program_interrupt(env, PGM_SPECIFICATION, 6);
+    program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND);
     g_assert_not_reached();
 }
 
@@ -1697,14 +1697,14 @@ uint32_t HELPER(testblock)(CPUS390XState *env, uint64_t real_addr)
     if (!address_space_access_valid(&address_space_memory, abs_addr,
                                     TARGET_PAGE_SIZE, true)) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_ADDRESSING, 4);
+        program_interrupt(env, PGM_ADDRESSING, ILEN_UNWIND);
         return 1;
     }
 
     /* Check low-address protection */
     if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_PROTECTION, 4);
+        program_interrupt(env, PGM_PROTECTION, ILEN_UNWIND);
         return 1;
     }
 
@@ -1859,7 +1859,7 @@ void HELPER(idte)(CPUS390XState *env, uint64_t r1, uint64_t r2, uint32_t m4)
 
     if (r2 & 0xff000) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_SPECIFICATION, 4);
+        program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND);
     }
 
     if (!(r2 & 0x800)) {
@@ -2015,7 +2015,7 @@ uint64_t HELPER(lra)(CPUS390XState *env, uint64_t addr)
     /* XXX incomplete - has more corner cases */
     if (!(env->psw.mask & PSW_MASK_64) && (addr >> 32)) {
         cpu_restore_state(cs, GETPC());
-        program_interrupt(env, PGM_SPECIAL_OP, 2);
+        program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND);
     }
 
     old_exc = cs->exception_index;
@@ -2174,7 +2174,7 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t dest, uint64_t src,
 
     if (!(env->psw.mask & PSW_MASK_DAT)) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_SPECIAL_OP, 6);
+        program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND);
     }
 
     /* OAC (operand access control) for the first operand -> dest */
@@ -2206,16 +2206,16 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t dest, uint64_t src,
 
     if (dest_a && dest_as == AS_HOME && (env->psw.mask & PSW_MASK_PSTATE)) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_SPECIAL_OP, 6);
+        program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND);
     }
     if (!(env->cregs[0] & CR0_SECONDARY) &&
         (dest_as == AS_SECONDARY || src_as == AS_SECONDARY)) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_SPECIAL_OP, 6);
+        program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND);
     }
     if (!psw_key_valid(env, dest_key) || !psw_key_valid(env, src_key)) {
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_PRIVILEGED, 6);
+        program_interrupt(env, PGM_PRIVILEGED, ILEN_UNWIND);
     }
 
     len = wrap_length(env, len);
@@ -2230,7 +2230,7 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t dest, uint64_t src,
         qemu_log_mask(LOG_UNIMP, "%s: AR-mode and PSTATE support missing\n",
                       __func__);
         cpu_restore_state(cs, ra);
-        program_interrupt(env, PGM_ADDRESSING, 6);
+        program_interrupt(env, PGM_ADDRESSING, ILEN_UNWIND);
     }
 
     /* FIXME: a) LAP
diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c
index 452b2bd902..376dbd68c2 100644
--- a/target/s390x/misc_helper.c
+++ b/target/s390x/misc_helper.c
@@ -57,7 +57,7 @@ void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp,
 
     cs->exception_index = EXCP_PGM;
     env->int_pgm_code = excp;
-    env->int_pgm_ilen = ILEN_AUTO;
+    env->int_pgm_ilen = ILEN_UNWIND;
 
     /* Use the (ultimate) callers address to find the insn that trapped.  */
     cpu_restore_state(cs, retaddr);
-- 
2.13.3

  parent reply	other threads:[~2017-07-25  2:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25  2:36 [Qemu-devel] [PATCH 0/4] target/s390x ilen via unwinding Richard Henderson
2017-07-25  2:36 ` [Qemu-devel] [PATCH 1/4] target/s390x: Add ilen to unwind data Richard Henderson
2017-07-25  7:15   ` David Hildenbrand
2017-07-25  2:36 ` Richard Henderson [this message]
2017-07-25  7:18   ` [Qemu-devel] [PATCH 2/4] target/s390x: Use ILEN_UNWIND in trivial cases David Hildenbrand
2017-07-25  2:36 ` [Qemu-devel] [PATCH 3/4] target/s390x: Use unwind info in STSI Richard Henderson
2017-07-25  7:19   ` David Hildenbrand
2017-07-25  2:36 ` [Qemu-devel] [PATCH 4/4] target/s390x: Use ilen from unwind in tlb_fill 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=20170725023611.9169-3-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=david@redhat.com \
    --cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.