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:
@@ -63,6 +63,9 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams * params,
|
||||
void
|
||||
AlphaLiveProcess::startup()
|
||||
{
|
||||
if (checkpointRestored)
|
||||
return;
|
||||
|
||||
argsInit(MachineBytes, VMPageSize);
|
||||
|
||||
threadContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer());
|
||||
|
||||
@@ -63,5 +63,8 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
|
||||
void
|
||||
MipsLiveProcess::startup()
|
||||
{
|
||||
if (checkpointRestored)
|
||||
return;
|
||||
|
||||
argsInit(MachineBytes, VMPageSize);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user