summaryrefslogtreecommitdiff
path: root/src/arch/arm/tlb.cc
diff options
context:
space:
mode:
authorDylan Johnson <Dylan.Johnson@ARM.com>2016-08-02 10:38:02 +0100
committerDylan Johnson <Dylan.Johnson@ARM.com>2016-08-02 10:38:02 +0100
commitfc6879097b04643f6345adad39e54f44afb85d2f (patch)
tree046cd5dd4701d0098160f9d46c9b158cc9548fe0 /src/arch/arm/tlb.cc
parent2950a95672599a9baf9007c18faf210ff9c3e392 (diff)
downloadgem5-fc6879097b04643f6345adad39e54f44afb85d2f.tar.xz
arm: Fix EL perceived at TLB for address translation instructions
During address translation instructions (such as AT S1E1R_Xt) the exception level can be different than the current exception level. This patch fixes how the TLB determines what EL to use during these instructions. Change-Id: Ia9ce229404de9e284bc1f7479fd2c580efd55f8f
Diffstat (limited to 'src/arch/arm/tlb.cc')
-rw-r--r--src/arch/arm/tlb.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/arch/arm/tlb.cc b/src/arch/arm/tlb.cc
index 864f0c28c..536fa51cd 100644
--- a/src/arch/arm/tlb.cc
+++ b/src/arch/arm/tlb.cc
@@ -1220,7 +1220,30 @@ TLB::updateMiscReg(ThreadContext *tc, ArmTranslationType tranType)
(opModeToEL(op_mode) == EL0 && ELIs64(tc, EL1));
if (aarch64) { // AArch64
- aarch64EL = (ExceptionLevel) (uint8_t) cpsr.el;
+ // determine EL we need to translate in
+ switch (tranType) {
+ case S1E0Tran:
+ case S12E0Tran:
+ aarch64EL = EL0;
+ break;
+ case S1E1Tran:
+ case S12E1Tran:
+ aarch64EL = EL1;
+ break;
+ case S1E2Tran:
+ aarch64EL = EL2;
+ break;
+ case S1E3Tran:
+ aarch64EL = EL3;
+ break;
+ case NormalTran:
+ case S1CTran:
+ case S1S2NsTran:
+ case HypMode:
+ aarch64EL = (ExceptionLevel) (uint8_t) cpsr.el;
+ break;
+ }
+
switch (aarch64EL) {
case EL0:
case EL1:
@@ -1258,7 +1281,8 @@ TLB::updateMiscReg(ThreadContext *tc, ArmTranslationType tranType)
// compute it for every translation.
stage2Req = isStage2 ||
(hcr.vm && !isHyp && !isSecure &&
- !(tranType & S1CTran) && (aarch64EL < EL2));
+ !(tranType & S1CTran) && (aarch64EL < EL2) &&
+ !(tranType & S1E1Tran)); // <--- FIX THIS HACK
directToStage2 = !isStage2 && stage2Req && !sctlr.m;
} else {
vmid = 0;