SE: Fix page table and system serialization, don't reinit process if this is a checkpoint restore.

--HG--
extra : convert_revision : 03dcf3c088e57b7abab60efe700d947117888306
This commit is contained in:
Ali Saidi
2007-10-25 20:13:35 -04:00
parent b0e3aab5df
commit 0711f4f17a
8 changed files with 37 additions and 9 deletions

View File

@@ -63,6 +63,9 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams * params,
void
AlphaLiveProcess::startup()
{
if (checkpointRestored)
return;
argsInit(MachineBytes, VMPageSize);
threadContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer());

View File

@@ -63,5 +63,8 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
void
MipsLiveProcess::startup()
{
if (checkpointRestored)
return;
argsInit(MachineBytes, VMPageSize);
}

View 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

View 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++) {

View 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;
}
}

View 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;
}

View 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;

View 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