diff mbox

[2/4] target/s390x: Use ILEN_UNWIND in trivial cases

Message ID 20170725023611.9169-3-rth@twiddle.net (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Henderson July 25, 2017, 2:36 a.m. UTC
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(-)

Comments

David Hildenbrand July 25, 2017, 7:18 a.m. UTC | #1
>      /* 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;

This is the only place where int_pgm_ilen is ever set to ILEN_UNWIND.

Think it would be better to drop setting int_pgm_ilen here completely.

>  
>      /* Use the (ultimate) callers address to find the insn that trapped.  */
>      cpu_restore_state(cs, retaddr);
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox

Patch

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);