summaryrefslogtreecommitdiff
path: root/src/mem/page_table.cc
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2009-02-16 17:47:39 -0500
committerLisa Hsu <hsul@eecs.umich.edu>2009-02-16 17:47:39 -0500
commit5d029ff11e88ba0ab89c88e500c5d0d2edaf744e (patch)
treea8a7a44ac0d2fb3dedf3b33ec887c3f7dc9ebdd7 /src/mem/page_table.cc
parent89ea32325094665c16688212b5a2cd7b7bbf5f03 (diff)
downloadgem5-5d029ff11e88ba0ab89c88e500c5d0d2edaf744e.tar.xz
sycalls: implement mremap() and add DATA flag for getrlimit(). mremap has been tested on Alpha, compiles for the rest but not tested. I don't see why it wouldn't work though.
Diffstat (limited to 'src/mem/page_table.cc')
-rw-r--r--src/mem/page_table.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mem/page_table.cc b/src/mem/page_table.cc
index 54165f293..bdcbbfec3 100644
--- a/src/mem/page_table.cc
+++ b/src/mem/page_table.cc
@@ -87,6 +87,44 @@ PageTable::allocate(Addr vaddr, int64_t size)
}
}
+void
+PageTable::remap(Addr vaddr, int64_t size, Addr new_vaddr)
+{
+ assert(pageOffset(vaddr) == 0);
+ assert(pageOffset(new_vaddr) == 0);
+
+ DPRINTF(MMU, "moving pages from vaddr %08p to %08p, size = %d\n", vaddr,
+ new_vaddr, size);
+
+ for (; size > 0; size -= pageSize, vaddr += pageSize, new_vaddr += pageSize) {
+ PTableItr iter = pTable.find(vaddr);
+
+ assert(iter != pTable.end());
+
+ pTable[new_vaddr] = pTable[vaddr];
+ pTable.erase(vaddr);
+ pTable[new_vaddr].updateVaddr(new_vaddr);
+ updateCache(new_vaddr, pTable[new_vaddr]);
+ }
+}
+
+void
+PageTable::deallocate(Addr vaddr, int64_t size)
+{
+ assert(pageOffset(vaddr) == 0);
+
+ DPRINTF(MMU, "Deallocating page: %#x-%#x\n", vaddr, vaddr+ size);
+
+ for (; size > 0; size -= pageSize, vaddr += pageSize) {
+ PTableItr iter = pTable.find(vaddr);
+
+ assert(iter != pTable.end());
+
+ pTable.erase(vaddr);
+ }
+
+}
+
bool
PageTable::lookup(Addr vaddr, TheISA::TlbEntry &entry)
{