ARM: Add checkpointing support
[gem5.git] / src / arch / arm / tlb.hh
index eec52d9d294650e41499658799db92bb21a33e26..bd723e8d1851bca4739e89249c2148a779b56639 100644 (file)
@@ -83,12 +83,9 @@ class TLB : public BaseTLB
         MustBeOne = 0x80
     };
   protected:
-    typedef std::multimap<Addr, int> PageTable;
-    PageTable lookupTable;     // Quick lookup into page table
 
     TlbEntry *table;   // the Page Table
     int size;                  // TLB Size
-    int nlu;                   // not last used entry (for replacement)
 
     uint32_t _attr;      // Memory attributes for last accessed TLB entry
 
@@ -96,8 +93,13 @@ class TLB : public BaseTLB
     TableWalker *tableWalker;
 #endif
 
-    void nextnlu() { if (++nlu >= size) nlu = 0; }
-    TlbEntry *lookup(Addr vpn, uint8_t asn);
+    /** Lookup an entry in the TLB
+     * @param vpn virtual address
+     * @param asn context id/address space id to use
+     * @param functional if the lookup should modify state
+     * @return pointer to TLB entrry if it exists
+     */
+    TlbEntry *lookup(Addr vpn, uint8_t asn, bool functional = false);
 
     // Access Stats
     mutable Stats::Scalar read_hits;
@@ -112,6 +114,7 @@ class TLB : public BaseTLB
     Stats::Formula misses;
     Stats::Formula accesses;
 
+    int rangeMRU; //On lookup, only move entries ahead when outside rangeMRU
 
   public:
     typedef ArmTLBParams Params;
@@ -154,6 +157,16 @@ class TLB : public BaseTLB
 
     static bool validVirtualAddress(Addr vaddr);
 
+    /**
+     * Do a functional lookup on the TLB (for debugging)
+     * and don't modify any internal state
+     * @param tc thread context to get the context id from
+     * @param vaddr virtual address to translate
+     * @param pa returned physical address
+     * @return if the translation was successful
+     */
+    bool translateFunctional(ThreadContext *tc, Addr vaddr, Addr &paddr);
+
     /** Accessor functions for memory attributes for last accessed TLB entry
      */
     void