diff options
author | Dylan Johnson <Dylan.Johnson@ARM.com> | 2016-08-02 10:38:02 +0100 |
---|---|---|
committer | Dylan Johnson <Dylan.Johnson@ARM.com> | 2016-08-02 10:38:02 +0100 |
commit | c2271e301dc441944dfc4c19ac932ea4f926a863 (patch) | |
tree | 651f335ff013c76759d533bd50e06aac94dd4c16 /src/arch/arm/faults.cc | |
parent | 996c1ed33c251f80ebdfd972477709f95bdcbe65 (diff) | |
download | gem5-c2271e301dc441944dfc4c19ac932ea4f926a863.tar.xz |
arm: Fix secure state checking in various places
Faults that could potentially be routed to the hypervisor checked
whether or not they were in a secure state without checking if security
was enabled or not. This caused faults not to be routed correctly. This
patch causes secure state checking to first ask if security is enabled.
Change-Id: I179e9b181b27f552734c9bab2b18d05ac579a119
Diffstat (limited to 'src/arch/arm/faults.cc')
-rw-r--r-- | src/arch/arm/faults.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/arch/arm/faults.cc b/src/arch/arm/faults.cc index d195d1a14..621076fe5 100644 --- a/src/arch/arm/faults.cc +++ b/src/arch/arm/faults.cc @@ -1116,7 +1116,7 @@ PrefetchAbort::routeToHyp(ThreadContext *tc) const toHyp |= (stage2 || ( (source == DebugEvent) && hdcr.tde && (cpsr.mode != MODE_HYP)) || ( (source == SynchronousExternalAbort) && hcr.tge && (cpsr.mode == MODE_USER)) - ) && !inSecureState(scr, cpsr); + ) && !inSecureState(tc); return toHyp; } @@ -1182,7 +1182,7 @@ DataAbort::routeToHyp(ThreadContext *tc) const ((source == AlignmentFault) || (source == SynchronousExternalAbort)) ) - ) && !inSecureState(scr, cpsr); + ) && !inSecureState(tc); return toHyp; } @@ -1272,7 +1272,7 @@ Interrupt::routeToHyp(ThreadContext *tc) const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR); CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR); // Determine whether IRQs are routed to Hyp mode. - toHyp = (!scr.irq && hcr.imo && !inSecureState(scr, cpsr)) || + toHyp = (!scr.irq && hcr.imo && !inSecureState(tc)) || (cpsr.mode == MODE_HYP); return toHyp; } @@ -1311,7 +1311,7 @@ FastInterrupt::routeToHyp(ThreadContext *tc) const HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR); CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR); // Determine whether IRQs are routed to Hyp mode. - toHyp = (!scr.fiq && hcr.fmo && !inSecureState(scr, cpsr)) || + toHyp = (!scr.fiq && hcr.fmo && !inSecureState(tc)) || (cpsr.mode == MODE_HYP); return toHyp; } @@ -1380,10 +1380,9 @@ SystemError::routeToHyp(ThreadContext *tc) const SCR scr = tc->readMiscRegNoEffect(MISCREG_SCR_EL3); HCR hcr = tc->readMiscRegNoEffect(MISCREG_HCR); - CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR); - toHyp = (!scr.ea && hcr.amo && !inSecureState(scr, cpsr)) || - (!scr.ea && !scr.rw && !hcr.amo && !inSecureState(scr,cpsr)); + toHyp = (!scr.ea && hcr.amo && !inSecureState(tc)) || + (!scr.ea && !scr.rw && !hcr.amo && !inSecureState(tc)); return toHyp; } |