Cache: Remove dangling doWriteback declaration
[gem5.git] / src / mem / page_table.hh
index 845bb911278793dad5b3aa0a23d22d85c66cb3b6..b1b5227bed74a2faffb8a05b80e82fdb5c2c5a17 100644 (file)
  * Declaration of a non-full system Page Table.
  */
 
-#ifndef __PAGE_TABLE__
-#define __PAGE_TABLE__
+#ifndef __MEM_PAGE_TABLE_HH__
+#define __MEM_PAGE_TABLE_HH__
 
 #include <string>
 
-#include "sim/faults.hh"
 #include "arch/isa_traits.hh"
 #include "arch/tlb.hh"
 #include "base/hashmap.hh"
+#include "base/types.hh"
+#include "config/the_isa.hh"
 #include "mem/request.hh"
-#include "sim/host.hh"
 #include "sim/serialize.hh"
 
-class System;
-
 /**
  * Page Table Declaration.
  */
@@ -68,18 +66,33 @@ class PageTable
     const Addr pageSize;
     const Addr offsetMask;
 
-    System *system;
+    const uint64_t pid;
+    const std::string _name;
 
   public:
 
-    PageTable(System *_system, Addr _pageSize = TheISA::VMPageSize);
+    PageTable(const std::string &__name, uint64_t _pid,
+              Addr _pageSize = TheISA::VMPageSize);
 
     ~PageTable();
 
+    // for DPRINTF compatibility
+    const std::string name() const { return _name; }
+
     Addr pageAlign(Addr a)  { return (a & ~offsetMask); }
     Addr pageOffset(Addr a) { return (a &  offsetMask); }
 
-    void allocate(Addr vaddr, int64_t size);
+    void map(Addr vaddr, Addr paddr, int64_t size, bool clobber = false);
+    void remap(Addr vaddr, int64_t size, Addr new_vaddr);
+    void unmap(Addr vaddr, int64_t size);
+
+    /**
+     * Check if any pages in a region are already allocated
+     * @param vaddr The starting virtual address of the region.
+     * @param size The length of the region.
+     * @return True if no pages in the region are mapped.
+     */
+    bool isUnmapped(Addr vaddr, int64_t size);
 
     /**
      * Lookup function
@@ -91,10 +104,18 @@ class PageTable
     /**
      * Translate function
      * @param vaddr The virtual address.
-     * @return Physical address from translation.
+     * @param paddr Physical address from translation.
+     * @return True if translation exists
      */
     bool translate(Addr vaddr, Addr &paddr);
 
+    /**
+     * Simplified translate function (just check for translation)
+     * @param vaddr The virtual address.
+     * @return True if translation exists
+     */
+    bool translate(Addr vaddr) { Addr dummy; return translate(vaddr, dummy); }
+
     /**
      * Perform a translation on the memory request, fills in paddr
      * field of req.
@@ -123,4 +144,4 @@ class PageTable
     void unserialize(Checkpoint *cp, const std::string &section);
 };
 
-#endif
+#endif // __MEM_PAGE_TABLE_HH__