* 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 Process;
-
/**
* Page Table Declaration.
*/
const Addr pageSize;
const Addr offsetMask;
- Process *process;
+ const uint64_t pid;
+ const std::string _name;
public:
- PageTable(Process *_process, 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
/**
* 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.
void unserialize(Checkpoint *cp, const std::string §ion);
};
-#endif
+#endif // __MEM_PAGE_TABLE_HH__