#include "base/output.hh"
#include "base/trace.hh"
#include "cpu/profile.hh"
+#include "cpu/quiesce_event.hh"
#include "kern/kernel_stats.hh"
#include "sim/serialize.hh"
#include "sim/sim_exit.hh"
: _status(ExecContext::Unallocated), cpu(_cpu), thread_num(_thread_num),
cpu_id(-1), lastActivate(0), lastSuspend(0), mem(_mem), itb(_itb),
dtb(_dtb), system(_sys), memctrl(_sys->memctrl), physmem(_sys->physmem),
- profile(NULL), quiesceEvent(this), func_exe_inst(0), storeCondFailures(0)
+ profile(NULL), func_exe_inst(0), storeCondFailures(0)
{
proxy = new ProxyExecContext<CPUExecContext>(this);
+ quiesceEvent = new EndQuiesceEvent(proxy);
+
memset(®s, 0, sizeof(RegFile));
if (cpu->params->profile) {
Process *_process, int _asid)
: _status(ExecContext::Unallocated),
cpu(_cpu), thread_num(_thread_num), cpu_id(-1), lastActivate(0),
- lastSuspend(0), process(_process), mem(process->getMemory()), asid(_asid),
+ lastSuspend(0), process(_process), mem(NULL), asid(_asid),
func_exe_inst(0), storeCondFailures(0)
{
memset(®s, 0, sizeof(RegFile));
CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num,
FunctionalMemory *_mem, int _asid)
- : cpu(_cpu), thread_num(_thread_num), process(0), mem(_mem), asid(_asid),
+ : cpu(_cpu), thread_num(_thread_num), process(0), mem(NULL), asid(_asid),
func_exe_inst(0), storeCondFailures(0)
{
memset(®s, 0, sizeof(RegFile));
profile->dump(proxy, *os);
}
-CPUExecContext::EndQuiesceEvent::EndQuiesceEvent(CPUExecContext *_cpuXC)
- : Event(&mainEventQueue), cpuXC(_cpuXC)
-{
-}
-
-void
-CPUExecContext::EndQuiesceEvent::process()
-{
- cpuXC->activate();
-}
-
-const char*
-CPUExecContext::EndQuiesceEvent::description()
-{
- return "End Quiesce Event.";
-}
-
void
CPUExecContext::profileClear()
{
#if FULL_SYSTEM
Tick quiesceEndTick = 0;
- if (quiesceEvent.scheduled())
- quiesceEndTick = quiesceEvent.when();
+ if (quiesceEvent->scheduled())
+ quiesceEndTick = quiesceEvent->when();
SERIALIZE_SCALAR(quiesceEndTick);
#endif
Tick quiesceEndTick;
UNSERIALIZE_SCALAR(quiesceEndTick);
if (quiesceEndTick)
- quiesceEvent.schedule(quiesceEndTick);
+ quiesceEvent->schedule(quiesceEndTick);
#endif
}
lastActivate = curTick;
+ if (status() == ExecContext::Unallocated) {
+ cpu->activateWhenReady(thread_num);
+ return;
+ }
+
_status = ExecContext::Active;
+
+ // status() == Suspended
cpu->activateContext(thread_num, delay);
}