diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2007-10-25 20:13:35 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2007-10-25 20:13:35 -0400 |
commit | 0711f4f17a4b4ac61b07cbe742f0d193f919ea8f (patch) | |
tree | 6fdd5b340696c7506dc85f4eb8cb39421da3ccaa | |
parent | b0e3aab5df9328ddfd13e396456cebdcaf0c8912 (diff) | |
download | gem5-0711f4f17a4b4ac61b07cbe742f0d193f919ea8f.tar.xz |
SE: Fix page table and system serialization, don't reinit process if this is a checkpoint restore.
--HG--
extra : convert_revision : 03dcf3c088e57b7abab60efe700d947117888306
-rw-r--r-- | src/arch/alpha/process.cc | 3 | ||||
-rw-r--r-- | src/arch/mips/process.cc | 3 | ||||
-rw-r--r-- | src/arch/sparc/process.cc | 3 | ||||
-rw-r--r-- | src/arch/x86/process.cc | 3 | ||||
-rw-r--r-- | src/mem/page_table.cc | 18 | ||||
-rw-r--r-- | src/sim/process.cc | 6 | ||||
-rw-r--r-- | src/sim/process.hh | 2 | ||||
-rw-r--r-- | src/sim/system.cc | 8 |
8 files changed, 37 insertions, 9 deletions
diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index ef53021c5..c2d23ecdd 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -63,6 +63,9 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams * params, void AlphaLiveProcess::startup() { + if (checkpointRestored) + return; + argsInit(MachineBytes, VMPageSize); threadContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer()); diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc index 3ce6b19fa..d330b1913 100644 --- a/src/arch/mips/process.cc +++ b/src/arch/mips/process.cc @@ -63,5 +63,8 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params, void MipsLiveProcess::startup() { + if (checkpointRestored) + return; + argsInit(MachineBytes, VMPageSize); } diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index e0d204a2d..ffe430ac7 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -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 diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index db32437d5..c91bcc12f 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -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++) { diff --git a/src/mem/page_table.cc b/src/mem/page_table.cc index efafc3f19..8889879c3 100644 --- a/src/mem/page_table.cc +++ b/src/mem/page_table.cc @@ -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 §ion) 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; } } diff --git a/src/sim/process.cc b/src/sim/process.cc index c5be4087d..01155ae32 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -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 §ion) UNSERIALIZE_ARRAY(fd_map, MAX_FD); pTable->unserialize(cp, section); + + + checkpointRestored = true; + } diff --git a/src/sim/process.hh b/src/sim/process.hh index d43208c27..0d2db959c 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -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; diff --git a/src/sim/system.cc b/src/sim/system.cc index 41c1b94e3..7dc1d2ba9 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -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 §ion) { #if FULL_SYSTEM kernelSymtab->unserialize("kernel_symtab", cp, section); -#endif // FULL_SYSTEM +#else // !FULL_SYSTEM + UNSERIALIZE_SCALAR(page_ptr); +#endif } void |