diff mbox

[4/4] target/s390x: Use ilen from unwind in tlb_fill

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

Commit Message

Richard Henderson July 25, 2017, 2:36 a.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target/s390x/mem_helper.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 026189aefd..1141f1362b 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -43,7 +43,18 @@  void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type,
 {
     int ret = s390_cpu_handle_mmu_fault(cs, addr, access_type, mmu_idx);
     if (unlikely(ret != 0)) {
-        cpu_loop_exit_restore(cs, retaddr);
+        cpu_restore_state(cs, retaddr);
+
+        /* Note that handle_mmu_fault sets ilen to either 2 (for code)
+           or AUTO (for data).  We can resolve AUTO now, as if it was
+           set to UNWIND -- that will have been done via assignment
+           in cpu_restore_state.  Otherwise re-examine access_type.  */
+        if (access_type == MMU_INST_FETCH) {
+            CPUS390XState *env = cs->env_ptr;
+            env->int_pgm_ilen = 2;
+        }
+
+        cpu_loop_exit(cs);
     }
 }