mem-cache: Add multiple eviction stats
[gem5.git] / src / arch / arm / pagetable.hh
index 856e0d54580104f75e50aacf620ce7ae34ef8618..240a1cad8a290272fb8e5f4a6a1cb43a0efd841b 100644 (file)
@@ -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
     {