summaryrefslogtreecommitdiff
path: root/src/sim/pseudo_inst.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2011-01-07 21:50:29 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2011-01-07 21:50:29 -0800
commitdf9f99567d43c9dfcecc625dce748c561699b307 (patch)
tree3f4601fde4ede7c062406565b9506304ab07d58b /src/sim/pseudo_inst.cc
parentd60c293bbc9125eb939a08831b86a3f38920cdd4 (diff)
downloadgem5-df9f99567d43c9dfcecc625dce748c561699b307.tar.xz
pseudoinst: get rid of mainEventQueue references.
Avoid direct references to mainEventQueue in pseudo-insts by indirecting through associated CPU object. Made exitSimLoop() more flexible to enable some of these.
Diffstat (limited to 'src/sim/pseudo_inst.cc')
-rw-r--r--src/sim/pseudo_inst.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 683397116..49298c6a9 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -88,17 +88,19 @@ quiesce(ThreadContext *tc)
void
quiesceNs(ThreadContext *tc, uint64_t ns)
{
- if (!tc->getCpuPtr()->params()->do_quiesce || ns == 0)
+ BaseCPU *cpu = tc->getCpuPtr();
+
+ if (!cpu->params()->do_quiesce || ns == 0)
return;
EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
Tick resume = curTick + SimClock::Int::ns * ns;
- mainEventQueue.reschedule(quiesceEvent, resume, true);
+ cpu->reschedule(quiesceEvent, resume, true);
DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
- tc->getCpuPtr()->name(), ns, resume);
+ cpu->name(), ns, resume);
tc->suspend();
if (tc->getKernelStats())
@@ -108,17 +110,19 @@ quiesceNs(ThreadContext *tc, uint64_t ns)
void
quiesceCycles(ThreadContext *tc, uint64_t cycles)
{
- if (!tc->getCpuPtr()->params()->do_quiesce || cycles == 0)
+ BaseCPU *cpu = tc->getCpuPtr();
+
+ if (!cpu->params()->do_quiesce || cycles == 0)
return;
EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
- Tick resume = curTick + tc->getCpuPtr()->ticks(cycles);
+ Tick resume = curTick + cpu->ticks(cycles);
- mainEventQueue.reschedule(quiesceEvent, resume, true);
+ cpu->reschedule(quiesceEvent, resume, true);
DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
- tc->getCpuPtr()->name(), cycles, resume);
+ cpu->name(), cycles, resume);
tc->suspend();
if (tc->getKernelStats())
@@ -153,8 +157,7 @@ void
m5exit(ThreadContext *tc, Tick delay)
{
Tick when = curTick + delay * SimClock::Int::ns;
- Event *event = new SimLoopExitEvent("m5_exit instruction encountered", 0);
- mainEventQueue.schedule(event, when);
+ exitSimLoop("m5_exit instruction encountered", 0, when);
}
#if FULL_SYSTEM
@@ -271,8 +274,7 @@ m5checkpoint(ThreadContext *tc, Tick delay, Tick period)
Tick when = curTick + delay * SimClock::Int::ns;
Tick repeat = period * SimClock::Int::ns;
- Event *event = new SimLoopExitEvent("checkpoint", 0, repeat);
- mainEventQueue.schedule(event, when);
+ exitSimLoop("checkpoint", 0, when, repeat);
}
#if FULL_SYSTEM