summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorMichael LeBeane <michael.lebeane@amd.com>2016-09-13 23:17:42 -0400
committerMichael LeBeane <michael.lebeane@amd.com>2016-09-13 23:17:42 -0400
commit458d4a3c7bff9365e9d732c56f105b5b7bd37739 (patch)
tree91c48b32127fc2ded18dfc6edf3b4077d3b021e4 /src/sim
parent2068af5768fdd15acaf7a8bad766f7005f86e0c2 (diff)
downloadgem5-458d4a3c7bff9365e9d732c56f105b5b7bd37739.tar.xz
sim: Refactor quiesce and remove FS asserts
The quiesce family of magic ops can be simplified by the inclusion of quiesceTick() and quiesce() functions on ThreadContext. This patch also gets rid of the FS guards, since suspending a CPU is also a valid operation for SE mode.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/pseudo_inst.cc79
1 files changed, 4 insertions, 75 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 8f20c5ff9..4f9bbff6e 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -234,105 +234,34 @@ void
quiesce(ThreadContext *tc)
{
DPRINTF(PseudoInst, "PseudoInst::quiesce()\n");
- if (!FullSystem)
- panicFsOnlyPseudoInst("quiesce");
-
- if (!tc->getCpuPtr()->params()->do_quiesce)
- return;
-
- DPRINTF(Quiesce, "%s: quiesce()\n", tc->getCpuPtr()->name());
-
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->quiesce();
}
void
quiesceSkip(ThreadContext *tc)
{
DPRINTF(PseudoInst, "PseudoInst::quiesceSkip()\n");
- if (!FullSystem)
- panicFsOnlyPseudoInst("quiesceSkip");
-
- BaseCPU *cpu = tc->getCpuPtr();
-
- if (!cpu->params()->do_quiesce)
- return;
-
- EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
-
- Tick resume = cpu->nextCycle() + 1;
-
- cpu->reschedule(quiesceEvent, resume, true);
-
- DPRINTF(Quiesce, "%s: quiesceSkip() until %d\n",
- cpu->name(), resume);
-
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->quiesceTick(tc->getCpuPtr()->nextCycle() + 1);
}
void
quiesceNs(ThreadContext *tc, uint64_t ns)
{
DPRINTF(PseudoInst, "PseudoInst::quiesceNs(%i)\n", ns);
- if (!FullSystem)
- panicFsOnlyPseudoInst("quiesceNs");
-
- BaseCPU *cpu = tc->getCpuPtr();
-
- if (!cpu->params()->do_quiesce)
- return;
-
- EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
-
- Tick resume = curTick() + SimClock::Int::ns * ns;
-
- cpu->reschedule(quiesceEvent, resume, true);
-
- DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
- cpu->name(), ns, resume);
-
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->quiesceTick(curTick() + SimClock::Int::ns * ns);
}
void
quiesceCycles(ThreadContext *tc, uint64_t cycles)
{
DPRINTF(PseudoInst, "PseudoInst::quiesceCycles(%i)\n", cycles);
- if (!FullSystem)
- panicFsOnlyPseudoInst("quiesceCycles");
-
- BaseCPU *cpu = tc->getCpuPtr();
-
- if (!cpu->params()->do_quiesce)
- return;
-
- EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
-
- Tick resume = cpu->clockEdge(Cycles(cycles));
-
- cpu->reschedule(quiesceEvent, resume, true);
-
- DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
- cpu->name(), cycles, resume);
-
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->quiesceTick(tc->getCpuPtr()->clockEdge(Cycles(cycles)));
}
uint64_t
quiesceTime(ThreadContext *tc)
{
DPRINTF(PseudoInst, "PseudoInst::quiesceTime()\n");
- if (!FullSystem) {
- panicFsOnlyPseudoInst("quiesceTime");
- return 0;
- }
return (tc->readLastActivate() - tc->readLastSuspend()) /
SimClock::Int::ns;