diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-10-22 22:30:08 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-10-22 22:30:08 -0700 |
commit | 6f9d294e8685f49d91af48065736ac1d67e53718 (patch) | |
tree | 1481f450d43324b79da17c80f27bdb1946b7c232 /src/mem/page_table.hh | |
parent | 4d5f2c28a88f83d390e80407f55a8a02ead33878 (diff) | |
download | gem5-6f9d294e8685f49d91af48065736ac1d67e53718.tar.xz |
SE: move page allocation from PageTable to Process
PageTable supported an allocate() call that called back
through the Process to allocate memory, but did not have
a method to map addresses without allocating new pages.
It makes more sense for Process to do the allocation, so
this method was renamed allocateMem() and moved to Process,
and uses a new map() call on PageTable.
The remaining uses of the process pointer in PageTable
were only to get the name and the PID, so by passing these
in directly in the constructor, we can make PageTable
completely independent of Process.
Diffstat (limited to 'src/mem/page_table.hh')
-rw-r--r-- | src/mem/page_table.hh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mem/page_table.hh b/src/mem/page_table.hh index d60f4a433..b1b5227be 100644 --- a/src/mem/page_table.hh +++ b/src/mem/page_table.hh @@ -46,8 +46,6 @@ #include "mem/request.hh" #include "sim/serialize.hh" -class Process; - /** * Page Table Declaration. */ @@ -68,20 +66,25 @@ class PageTable 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, bool clobber = false); + void map(Addr vaddr, Addr paddr, int64_t size, bool clobber = false); void remap(Addr vaddr, int64_t size, Addr new_vaddr); - void deallocate(Addr vaddr, int64_t size); + void unmap(Addr vaddr, int64_t size); /** * Check if any pages in a region are already allocated |