SE: Fix page table and system serialization, don't reinit process if this is a checkp...
authorAli Saidi <saidi@eecs.umich.edu>
Fri, 26 Oct 2007 00:13:35 +0000 (20:13 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Fri, 26 Oct 2007 00:13:35 +0000 (20:13 -0400)
--HG--
extra : convert_revision : 03dcf3c088e57b7abab60efe700d947117888306

src/arch/alpha/process.cc
src/arch/mips/process.cc
src/arch/sparc/process.cc
src/arch/x86/process.cc
src/mem/page_table.cc
src/sim/process.cc
src/sim/process.hh
src/sim/system.cc

index ef53021c513be413495c7d9c62e59065b910c767..c2d23ecdd828bb006fb23af148b79d6215c13c94 100644 (file)
@@ -63,6 +63,9 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams * params,
 void
 AlphaLiveProcess::startup()
 {
+    if (checkpointRestored)
+        return;
+
     argsInit(MachineBytes, VMPageSize);
 
     threadContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer());
index 3ce6b19fa0fa390016014da6021af8a3ba77b783..d330b19134d4880603f55dee830c62bb710af2b9 100644 (file)
@@ -63,5 +63,8 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
 void
 MipsLiveProcess::startup()
 {
+    if (checkpointRestored)
+        return;
+
     argsInit(MachineBytes, VMPageSize);
 }
index e0d204a2d4b9179a34dcbbab052bc5d1f041972e..ffe430ac74ddd3dfc5e02b69af06b040e204f4fe 100644 (file)
@@ -110,6 +110,9 @@ void SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc)
 void
 Sparc32LiveProcess::startup()
 {
+    if (checkpointRestored)
+        return;
+
     argsInit(32 / 8, VMPageSize);
 
     //From the SPARC ABI
index db32437d58f58c2ac23cecf07bd69620031c7632..c91bcc12f428395273e7cacc545591998fba3c7f 100644 (file)
@@ -141,6 +141,9 @@ void X86LiveProcess::handleTrap(int trapNum, ThreadContext *tc)
 void
 X86LiveProcess::startup()
 {
+    if (checkpointRestored)
+        return;
+
     argsInit(sizeof(IntReg), VMPageSize);
 
     for (int i = 0; i < threadContexts.size(); i++) {
index efafc3f19a814c3df35ffd23abe40a70a55c5aa7..8889879c3b15be2f9ec03c4748da00f3980e153e 100644 (file)
@@ -118,9 +118,12 @@ bool
 PageTable::translate(Addr vaddr, Addr &paddr)
 {
     TheISA::TlbEntry entry;
-    if (!lookup(vaddr, entry))
+    if (!lookup(vaddr, entry)) {
+        DPRINTF(MMU, "Couldn't Translate: %#x\n", vaddr);
         return false;
+    }
     paddr = pageOffset(vaddr) + entry.pageStart;
+    DPRINTF(MMU, "Translating: %#x->%#x\n", vaddr, paddr);
     return true;
 }
 
@@ -151,7 +154,9 @@ PageTable::serialize(std::ostream &os)
     PTableItr iter = pTable.begin();
     PTableItr end = pTable.end();
     while (iter != end) {
-        paramOut(os, csprintf("ptable.entry%dvaddr", count), iter->first);
+        os << "\n[" << csprintf("%s.Entry%d", name(), count) << "]\n";
+
+        paramOut(os, "vaddr", iter->first);
         iter->second.serialize(os);
 
         ++iter;
@@ -166,14 +171,15 @@ PageTable::unserialize(Checkpoint *cp, const std::string &section)
     int i = 0, count;
     paramIn(cp, section, "ptable.size", count);
     Addr vaddr;
-    TheISA::TlbEntry entry;
+    TheISA::TlbEntry *entry;
 
     pTable.clear();
 
     while(i < count) {
-        paramIn(cp, section, csprintf("ptable.entry%dvaddr", i), vaddr);
-        entry.unserialize(cp, section);
-        pTable[vaddr] = entry;
+        paramIn(cp, csprintf("%s.Entry%d", name(), i), "vaddr", vaddr);
+        entry = new TheISA::TlbEntry();
+        entry->unserialize(cp, csprintf("%s.Entry%d", name(), i));
+        pTable[vaddr] = *entry;
         ++i;
    }
 }
index c5be4087dcfb2f1a44864eb9b76ad537b6016d06..01155ae32bf7ae9fa636953d49b4b5b4d6424af2 100644 (file)
@@ -85,7 +85,7 @@ using namespace TheISA;
 int num_processes = 0;
 
 Process::Process(ProcessParams * params)
-    : SimObject(params), system(params->system),
+    : SimObject(params), system(params->system), checkpointRestored(false),
     max_stack_size(params->max_stack_size)
 {
     string in = params->input;
@@ -335,6 +335,10 @@ Process::unserialize(Checkpoint *cp, const std::string &section)
     UNSERIALIZE_ARRAY(fd_map, MAX_FD);
 
     pTable->unserialize(cp, section);
+
+
+    checkpointRestored = true;
+
 }
 
 
index d43208c272ed7a6c586ed7406c1ad58feeb3bc75..0d2db959ccf84e5ebef278ae4426c35695b8ab77 100644 (file)
@@ -74,6 +74,8 @@ class Process : public SimObject
     // created threads and are not initialized.
     bool initialContextLoaded;
 
+    bool checkpointRestored;
+
     // thread contexts associated with this process
     std::vector<ThreadContext *> threadContexts;
 
index 41c1b94e391be768f6ff4b99cc57fc474b139aae..7dc1d2ba9149dcdc59e6791068edb97ce3ee200c 100644 (file)
@@ -240,7 +240,9 @@ System::serialize(ostream &os)
 {
 #if FULL_SYSTEM
     kernelSymtab->serialize("kernel_symtab", os);
-#endif // FULL_SYSTEM
+#else // !FULL_SYSTEM
+    SERIALIZE_SCALAR(page_ptr);
+#endif
 }
 
 
@@ -249,7 +251,9 @@ System::unserialize(Checkpoint *cp, const string &section)
 {
 #if FULL_SYSTEM
     kernelSymtab->unserialize("kernel_symtab", cp, section);
-#endif // FULL_SYSTEM
+#else // !FULL_SYSTEM
+    UNSERIALIZE_SCALAR(page_ptr);
+#endif
 }
 
 void