From 74c66cc2a9590926f4a234f09accd5406eae15ff Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sun, 4 Mar 2018 21:10:45 -0500 Subject: [PATCH] target/arm: Make MMFAR banked for v8M Make the MMFAR register banked if v8M security extensions are enabled. Backports commit c51a5cfc9fae82099028eb12cb1d064ee07f348e from qemu --- qemu/target/arm/cpu.h | 2 +- qemu/target/arm/helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu/target/arm/cpu.h b/qemu/target/arm/cpu.h index f371e28a..f8fff83b 100644 --- a/qemu/target/arm/cpu.h +++ b/qemu/target/arm/cpu.h @@ -432,7 +432,7 @@ typedef struct CPUARMState { uint32_t cfsr; /* Configurable Fault Status */ uint32_t hfsr; /* HardFault Status */ uint32_t dfsr; /* Debug Fault Status Register */ - uint32_t mmfar; /* MemManage Fault Address */ + uint32_t mmfar[2]; /* MemManage Fault Address */ uint32_t bfar; /* BusFault Address */ unsigned mpu_ctrl[2]; /* MPU_CTRL */ int exception; diff --git a/qemu/target/arm/helper.c b/qemu/target/arm/helper.c index 0bc1d78c..3f721ccc 100644 --- a/qemu/target/arm/helper.c +++ b/qemu/target/arm/helper.c @@ -5644,10 +5644,10 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) case EXCP_DATA_ABORT: env->v7m.cfsr |= (R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK); - env->v7m.mmfar = env->exception.vaddress; + env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.DACCVIOL and MMFAR 0x%x\n", - env->v7m.mmfar); + env->v7m.mmfar[env->v7m.secure]); break; } // Unicorn: commented out