qemu-e2k/target
Peter Maydell 51c9122e92 target/arm: NS BusFault on vector table fetch escalates to NS HardFault
In the M-profile architecture, when we do a vector table fetch and it
fails, we need to report a HardFault.  Whether this is a Secure HF or
a NonSecure HF depends on several things.  If AIRCR.BFHFNMINS is 0
then HF is always Secure, because there is no NonSecure HardFault.
Otherwise, the answer depends on whether the 'underlying exception'
(MemManage, BusFault, SecureFault) targets Secure or NonSecure.  (In
the pseudocode, this is handled in the Vector() function: the final
exc.isSecure is calculated by looking at the exc.isSecure from the
exception returned from the memory access, not the isSecure input
argument.)

We weren't doing this correctly, because we were looking at
the target security domain of the exception we were trying to
load the vector table entry for. This produces errors of two kinds:
 * a load from the NS vector table which hits the "NS access
   to S memory" SecureFault should end up as a Secure HardFault,
   but we were raising an NS HardFault
 * a load from the S vector table which causes a BusFault
   should raise an NS HardFault if BFHFNMINS == 1 (because
   in that case all BusFaults are NonSecure), but we were raising
   a Secure HardFault

Correct the logic.

We also fix a comment error where we claimed that we might
be escalating MemManage to HardFault, and forgot about SecureFault.
(Vector loads can never hit MPU access faults, because they're
always aligned and always use the default address map.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190705094823.28905-1-peter.maydell@linaro.org
2019-07-15 14:17:04 +01:00
..
alpha Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
arm target/arm: NS BusFault on vector table fetch escalates to NS HardFault 2019-07-15 14:17:04 +01:00
cris Supply missing header guards 2019-06-12 13:20:21 +02:00
hppa hppa: Delete unused hppa_cpu_list() function 2019-07-05 17:08:03 -03:00
i386 Bugfixes. 2019-07-08 10:26:18 +01:00
lm32 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
m68k m68k comments break patch submission due to being incorrectly formatted 2019-06-26 17:14:39 +02:00
microblaze Supply missing header guards 2019-06-12 13:20:21 +02:00
mips MIPS queue for July 2nd, 2019 2019-07-03 21:19:03 +01:00
moxie Supply missing header guards 2019-06-12 13:20:21 +02:00
nios2 hmp: Move hmp.h to include/monitor/ 2019-07-02 07:19:45 +02:00
openrisc general: Replace global smp variables with smp machine properties 2019-07-05 17:07:36 -03:00
ppc Monitor patches for 2019-07-02 2019-07-03 00:16:43 +01:00
riscv RISC-V: Clear load reservations on context switch and SC 2019-06-25 22:37:04 -07:00
s390x s390x/tcg: move fallthrough annotation 2019-07-09 10:37:44 +02:00
sh4 hmp: Move hmp.h to include/monitor/ 2019-07-02 07:19:45 +02:00
sparc hmp: Move hmp.h to include/monitor/ 2019-07-02 07:19:45 +02:00
tilegx Normalize position of header guard 2019-06-12 13:20:20 +02:00
tricore tricore: add QSEED instruction 2019-06-25 15:02:07 +02:00
unicore32 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
xtensa hmp: Move hmp.h to include/monitor/ 2019-07-02 07:19:45 +02:00