Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/s390x/cpu-param.h | 4 ++
target/s390x/cpu.c | 12 +++++
target/s390x/tcg/translate.c | 86 +++++++++++++++++++++++-------------
3 files changed, 71 insertions(+), 31 deletions(-)
diff --git a/target/s390x/cpu-param.h b/target/s390x/cpu-param.h
index bf951a002e..52bb95de57 100644
--- a/target/s390x/cpu-param.h
+++ b/target/s390x/cpu-param.h
@@ -14,4 +14,8 @@
#define TARGET_VIRT_ADDR_SPACE_BITS 64
#define NB_MMU_MODES 4
+#ifndef CONFIG_USER_ONLY
+# define TARGET_TB_PCREL 1
+#endif
+
#endif
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index b10a8541ff..933ff06395 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -37,6 +37,7 @@
#ifndef CONFIG_USER_ONLY
#include "sysemu/reset.h"
#endif
+#include "exec/exec-all.h"
#define CR0_RESET 0xE0UL
#define CR14_RESET 0xC2000000UL;
@@ -83,6 +84,16 @@ uint64_t s390_cpu_get_psw_mask(CPUS390XState *env)
return r;
}
+static void s390_cpu_synchronize_from_tb(CPUState *cs,
+ const TranslationBlock *tb)
+{
+ /* The program counter is always up to date with TARGET_TB_PCREL. */
+ if (!TARGET_TB_PCREL) {
+ S390CPU *cpu = S390_CPU(cs);
+ cpu->env.psw.addr = tb_pc(tb);
+ }
+}