summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2023-03-16 17:44:18 +0100
committerThomas Huth <thuth@redhat.com>2023-03-20 09:32:50 +0100
commitce7ca2696811f4a61bdde26767d9c426abc72edf (patch)
tree0e10989b6e3e7cf7f2d77ca986a44f49a43d02d9
parent39344bbc13f419352a102a564cc00a11eb6ab7b9 (diff)
downloadfocaccia-qemu-ce7ca2696811f4a61bdde26767d9c426abc72edf.tar.gz
focaccia-qemu-ce7ca2696811f4a61bdde26767d9c426abc72edf.zip
target/s390x: Handle EXECUTE of odd addresses
Generate a specification exception in the helper before trying to fetch
the instruction.

Reported-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230316164428.275147-3-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r--target/s390x/tcg/mem_helper.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
index 00afae2b64..96b8ef61b5 100644
--- a/target/s390x/tcg/mem_helper.c
+++ b/target/s390x/tcg/mem_helper.c
@@ -2468,8 +2468,16 @@ void HELPER(stpq_parallel)(CPUS390XState *env, uint64_t addr,
 */
 void HELPER(ex)(CPUS390XState *env, uint32_t ilen, uint64_t r1, uint64_t addr)
 {
-    uint64_t insn = cpu_lduw_code(env, addr);
-    uint8_t opc = insn >> 8;
+    uint64_t insn;
+    uint8_t opc;
+
+    /* EXECUTE targets must be at even addresses.  */
+    if (addr & 1) {
+        tcg_s390_program_interrupt(env, PGM_SPECIFICATION, GETPC());
+    }
+
+    insn = cpu_lduw_code(env, addr);
+    opc = insn >> 8;
 
     /* Or in the contents of R1[56:63].  */
     insn |= r1 & 0xff;