Ruby: pass Packet->Req->contextId() to Ruby.
[gem5.git] / src / mem / page_table.hh
index 845bb911278793dad5b3aa0a23d22d85c66cb3b6..61da5f322a57d9119c54cec19bc6ddb21c46f0aa 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;
+class Process;
 
 /**
  * Page Table Declaration.
@@ -68,11 +68,11 @@ class PageTable
     const Addr pageSize;
     const Addr offsetMask;
 
-    System *system;
+    Process *process;
 
   public:
 
-    PageTable(System *_system, Addr _pageSize = TheISA::VMPageSize);
+    PageTable(Process *_process, Addr _pageSize = TheISA::VMPageSize);
 
     ~PageTable();
 
@@ -80,6 +80,8 @@ class PageTable
     Addr pageOffset(Addr a) { return (a &  offsetMask); }
 
     void allocate(Addr vaddr, int64_t size);
+    void remap(Addr vaddr, int64_t size, Addr new_vaddr);
+    void deallocate(Addr vaddr, int64_t size);
 
     /**
      * Lookup function
@@ -91,10 +93,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 +133,4 @@ class PageTable
     void unserialize(Checkpoint *cp, const std::string &section);
 };
 
-#endif
+#endif // __MEM_PAGE_TABLE_HH__