Implement Ali's review feedback.
Try to decrease indentation, and remove some redundant FullSystem checks.
This commit is contained in:
@@ -314,12 +314,11 @@ InOrderDynInst::simPalCheck(int palFunc)
|
||||
void
|
||||
InOrderDynInst::syscall(int64_t callnum)
|
||||
{
|
||||
if (FullSystem) {
|
||||
if (FullSystem)
|
||||
panic("Syscall emulation isn't available in FS mode.\n");
|
||||
} else {
|
||||
syscallNum = callnum;
|
||||
cpu->syscallContext(NoFault, this->threadNumber, this);
|
||||
}
|
||||
|
||||
syscallNum = callnum;
|
||||
cpu->syscallContext(NoFault, this->threadNumber, this);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -193,18 +193,17 @@ template <class Impl>
|
||||
void
|
||||
BaseO3DynInst<Impl>::syscall(int64_t callnum)
|
||||
{
|
||||
if (FullSystem) {
|
||||
if (FullSystem)
|
||||
panic("Syscall emulation isn't available in FS mode.\n");
|
||||
} else {
|
||||
// HACK: check CPU's nextPC before and after syscall. If it
|
||||
// changes, update this instruction's nextPC because the syscall
|
||||
// must have changed the nextPC.
|
||||
TheISA::PCState curPC = this->cpu->pcState(this->threadNumber);
|
||||
this->cpu->syscall(callnum, this->threadNumber);
|
||||
TheISA::PCState newPC = this->cpu->pcState(this->threadNumber);
|
||||
if (!(curPC == newPC)) {
|
||||
this->pcState(newPC);
|
||||
}
|
||||
|
||||
// HACK: check CPU's nextPC before and after syscall. If it
|
||||
// changes, update this instruction's nextPC because the syscall
|
||||
// must have changed the nextPC.
|
||||
TheISA::PCState curPC = this->cpu->pcState(this->threadNumber);
|
||||
this->cpu->syscall(callnum, this->threadNumber);
|
||||
TheISA::PCState newPC = this->cpu->pcState(this->threadNumber);
|
||||
if (!(curPC == newPC)) {
|
||||
this->pcState(newPC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,22 +75,23 @@ struct O3ThreadState : public ThreadState {
|
||||
: ThreadState(_cpu, _thread_num, _process),
|
||||
cpu(_cpu), inSyscall(0), trapPending(0)
|
||||
{
|
||||
if (FullSystem) {
|
||||
if (cpu->params()->profile) {
|
||||
profile = new FunctionProfile(
|
||||
cpu->params()->system->kernelSymtab);
|
||||
Callback *cb =
|
||||
new MakeCallback<O3ThreadState,
|
||||
&O3ThreadState::dumpFuncProfile>(this);
|
||||
registerExitCallback(cb);
|
||||
}
|
||||
if (!FullSystem)
|
||||
return;
|
||||
|
||||
// let's fill with a dummy node for now so we don't get a segfault
|
||||
// on the first cycle when there's no node available.
|
||||
static ProfileNode dummyNode;
|
||||
profileNode = &dummyNode;
|
||||
profilePC = 3;
|
||||
if (cpu->params()->profile) {
|
||||
profile = new FunctionProfile(
|
||||
cpu->params()->system->kernelSymtab);
|
||||
Callback *cb =
|
||||
new MakeCallback<O3ThreadState,
|
||||
&O3ThreadState::dumpFuncProfile>(this);
|
||||
registerExitCallback(cb);
|
||||
}
|
||||
|
||||
// let's fill with a dummy node for now so we don't get a segfault
|
||||
// on the first cycle when there's no node available.
|
||||
static ProfileNode dummyNode;
|
||||
profileNode = &dummyNode;
|
||||
profilePC = 3;
|
||||
}
|
||||
|
||||
/** Pointer to the ThreadContext of this thread. */
|
||||
|
||||
@@ -396,8 +396,8 @@ class BaseSimpleCPU : public BaseCPU
|
||||
{
|
||||
if (FullSystem)
|
||||
panic("Syscall emulation isn't available in FS mode.\n");
|
||||
else
|
||||
thread->syscall(callnum);
|
||||
|
||||
thread->syscall(callnum);
|
||||
}
|
||||
|
||||
bool misspeculating() { return thread->misspeculating(); }
|
||||
|
||||
@@ -68,14 +68,15 @@ ThreadState::serialize(std::ostream &os)
|
||||
// thread_num and cpu_id are deterministic from the config
|
||||
SERIALIZE_SCALAR(funcExeInst);
|
||||
|
||||
if (FullSystem) {
|
||||
Tick quiesceEndTick = 0;
|
||||
if (quiesceEvent->scheduled())
|
||||
quiesceEndTick = quiesceEvent->when();
|
||||
SERIALIZE_SCALAR(quiesceEndTick);
|
||||
if (kernelStats)
|
||||
kernelStats->serialize(os);
|
||||
}
|
||||
if (!FullSystem)
|
||||
return;
|
||||
|
||||
Tick quiesceEndTick = 0;
|
||||
if (quiesceEvent->scheduled())
|
||||
quiesceEndTick = quiesceEvent->when();
|
||||
SERIALIZE_SCALAR(quiesceEndTick);
|
||||
if (kernelStats)
|
||||
kernelStats->serialize(os);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -86,14 +87,15 @@ ThreadState::unserialize(Checkpoint *cp, const std::string §ion)
|
||||
// thread_num and cpu_id are deterministic from the config
|
||||
UNSERIALIZE_SCALAR(funcExeInst);
|
||||
|
||||
if (FullSystem) {
|
||||
Tick quiesceEndTick;
|
||||
UNSERIALIZE_SCALAR(quiesceEndTick);
|
||||
if (quiesceEndTick)
|
||||
baseCpu->schedule(quiesceEvent, quiesceEndTick);
|
||||
if (kernelStats)
|
||||
kernelStats->unserialize(cp, section);
|
||||
}
|
||||
if (!FullSystem)
|
||||
return;
|
||||
|
||||
Tick quiesceEndTick;
|
||||
UNSERIALIZE_SCALAR(quiesceEndTick);
|
||||
if (quiesceEndTick)
|
||||
baseCpu->schedule(quiesceEvent, quiesceEndTick);
|
||||
if (kernelStats)
|
||||
kernelStats->unserialize(cp, section);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user