diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-05-01 15:21:03 +0100 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-07-17 13:06:23 +0000 |
commit | 4dd475c1c0db6915f811a246c9e6fce8a61a6a77 (patch) | |
tree | ff494ce48de95600e3aac7cedc40905edcba2fdf /src/arch/arm/pagetable.hh | |
parent | f9b549fbf572ac1b8b40ee86411eb9331a2bf458 (diff) | |
download | gem5-4dd475c1c0db6915f811a246c9e6fce8a61a6a77.tar.xz |
arch-arm: Use ExceptionLevel type in TlbEntry
Replacing uint8_t with ExceptionLevel type in the arm TlbEntry. The
variable is representing the translation regime it is targeting.
Change-Id: Ifcd6e86c5d73f752e8476a2b7fda9ea74a0c7a3b
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19488
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/arch/arm/pagetable.hh')
-rw-r--r-- | src/arch/arm/pagetable.hh | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/arch/arm/pagetable.hh b/src/arch/arm/pagetable.hh index 856e0d545..240a1cad8 100644 --- a/src/arch/arm/pagetable.hh +++ b/src/arch/arm/pagetable.hh @@ -133,7 +133,7 @@ struct TlbEntry : public Serializable // True if the entry was brought in from a non-secure page table bool nstid; // Exception level on insert, AARCH64 EL0&1, AARCH32 -> el=1 - uint8_t el; + ExceptionLevel el; // Type of memory bool nonCacheable; // Can we wrap this in mtype? @@ -154,7 +154,7 @@ struct TlbEntry : public Serializable innerAttrs(0), outerAttrs(0), ap(read_only ? 0x3 : 0), hap(0x3), domain(DomainType::Client), mtype(MemoryType::StronglyOrdered), longDescFormat(false), isHyp(false), global(false), valid(true), - ns(true), nstid(true), el(0), nonCacheable(uncacheable), + ns(true), nstid(true), el(EL0), nonCacheable(uncacheable), shareable(false), outerShareable(false), xn(0), pxn(0) { // no restrictions by default, hap = 0x3 @@ -169,7 +169,7 @@ struct TlbEntry : public Serializable vmid(0), N(0), innerAttrs(0), outerAttrs(0), ap(0), hap(0x3), domain(DomainType::Client), mtype(MemoryType::StronglyOrdered), longDescFormat(false), isHyp(false), global(false), valid(false), - ns(true), nstid(true), el(0), nonCacheable(false), + ns(true), nstid(true), el(EL0), nonCacheable(false), shareable(false), outerShareable(false), xn(0), pxn(0) { // no restrictions by default, hap = 0x3 @@ -191,14 +191,14 @@ struct TlbEntry : public Serializable bool match(Addr va, uint8_t _vmid, bool hypLookUp, bool secure_lookup, - uint8_t target_el) const + ExceptionLevel target_el) const { return match(va, 0, _vmid, hypLookUp, secure_lookup, true, target_el); } bool match(Addr va, uint16_t asn, uint8_t _vmid, bool hypLookUp, - bool secure_lookup, bool ignore_asn, uint8_t target_el) const + bool secure_lookup, bool ignore_asn, ExceptionLevel target_el) const { bool match = false; Addr v = vpn << N; @@ -206,10 +206,8 @@ struct TlbEntry : public Serializable if (valid && va >= v && va <= v + size && (secure_lookup == !nstid) && (hypLookUp == isHyp)) { - if (target_el == 2 || target_el == 3) - match = (el == target_el); - else - match = (el == 0) || (el == 1); + match = checkELMatch(target_el); + if (match && !ignore_asn) { match = global || (asn == asid); } @@ -220,6 +218,16 @@ struct TlbEntry : public Serializable return match; } + bool + checkELMatch(ExceptionLevel target_el) const + { + if (target_el == EL2 || target_el == EL3) { + return (el == target_el); + } else { + return (el == EL0) || (el == EL1); + } + } + Addr pAddr(Addr va) const { |