summaryrefslogtreecommitdiff
path: root/src/mem/page_table.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-10-17 19:38:36 -0400
committerAli Saidi <saidi@eecs.umich.edu>2006-10-17 19:38:36 -0400
commite51b075a2706180bdc262cbcbdd5bafe5896ba12 (patch)
treec31aeaf70784ae5567752ccf9681017576813d99 /src/mem/page_table.cc
parent4fff6d460311d77e0056a546df41366d5a3b4604 (diff)
downloadgem5-e51b075a2706180bdc262cbcbdd5bafe5896ba12.tar.xz
add code to serialize se structures. Lisa is working on the python side of things and will test
src/mem/page_table.cc: src/mem/page_table.hh: add code to serialize/unserialize page table src/sim/process.cc: src/sim/process.hh: add code to serialize/unserialize process --HG-- extra : convert_revision : ee9eb5e2c38c5d317a2f381972c552d455e0db9e
Diffstat (limited to 'src/mem/page_table.cc')
-rw-r--r--src/mem/page_table.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mem/page_table.cc b/src/mem/page_table.cc
index 2b460306f..32da4282c 100644
--- a/src/mem/page_table.cc
+++ b/src/mem/page_table.cc
@@ -27,6 +27,7 @@
*
* Authors: Steve Reinhardt
* Ron Dreslinski
+ * Ali Saidi
*/
/**
@@ -97,6 +98,8 @@ PageTable::allocate(Addr vaddr, int64_t size)
// starting address must be page aligned
assert(pageOffset(vaddr) == 0);
+ DPRINTF(MMU, "Allocating Page: %#x-%#x\n", vaddr, vaddr+ size);
+
for (; size > 0; size -= pageSize, vaddr += pageSize) {
m5::hash_map<Addr,Addr>::iterator iter = pTable.find(vaddr);
@@ -159,3 +162,37 @@ PageTable::translate(RequestPtr &req)
req->setPaddr(paddr);
return page_check(req->getPaddr(), req->getSize());
}
+
+void
+PageTable::serialize(std::ostream &os)
+{
+ paramOut(os, "ptable.size", pTable.size());
+ int count = 0;
+
+ m5::hash_map<Addr,Addr>::iterator iter;
+ while (iter != pTable.end()) {
+ paramOut(os, csprintf("ptable.entry%dvaddr", count),iter->first);
+ paramOut(os, csprintf("ptable.entry%dpaddr", count),iter->second);
+ ++count;
+ }
+ assert(count == pTable.size());
+}
+
+void
+PageTable::unserialize(Checkpoint *cp, const std::string &section)
+{
+ int i = 0, count;
+ paramIn(cp, section, "ptable.size", count);
+ Addr vaddr, paddr;
+
+ pTable.clear();
+
+ while(i < count) {
+ paramIn(cp, section, csprintf("ptable.entry%dvaddr", i), vaddr);
+ paramIn(cp, section, csprintf("ptable.entry%dpaddr", i), paddr);
+ pTable[vaddr] = paddr;
+ ++i;
+ }
+
+}
+