aboutsummaryrefslogtreecommitdiff
path: root/target/s390x
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2023-03-16 17:44:17 +0100
committerThomas Huth <thuth@redhat.com>2023-03-20 09:32:50 +0100
commit39344bbc13f419352a102a564cc00a11eb6ab7b9 (patch)
treefb78ea8755ebbef1564c14745d905504202a3eb4 /target/s390x
parent5e8a0c6291fa9a5bec6e738a6206dc8be93c13ff (diff)
downloadqemu-39344bbc13f419352a102a564cc00a11eb6ab7b9.zip
qemu-39344bbc13f419352a102a564cc00a11eb6ab7b9.tar.gz
qemu-39344bbc13f419352a102a564cc00a11eb6ab7b9.tar.bz2
target/s390x: Handle branching to odd addresses
Let branching happen and try to generate a new translation block with an odd address. Generate a specification exception in cpu_get_tb_cpu_state(). Reported-by: Harold Grovesteen <h.grovsteen@tx.rr.com> 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-2-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'target/s390x')
-rw-r--r--target/s390x/cpu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 82c2f57..c47e7ad 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -29,6 +29,7 @@
#include "cpu_models.h"
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
+#include "tcg/tcg_s390x.h"
#define ELF_MACHINE_UNAME "S390X"
@@ -383,6 +384,14 @@ 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)
{
+ if (env->psw.addr & 1) {
+ /*
+ * Instructions must be at even addresses.
+ * This needs to be checked before address translation.
+ */
+ env->int_pgm_ilen = 2; /* see s390_cpu_tlb_fill() */
+ tcg_s390_program_interrupt(env, PGM_SPECIFICATION, 0);
+ }
*pc = env->psw.addr;
*cs_base = env->ex_value;
*flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;