Move quiesce event to its own class.
SConscript: Move quiesce event to its own file/class. --HG-- extra : convert_revision : 6aa7863adb529fc03142666213c3ec348825bd3b
This commit is contained in:
parent
bd38b56774
commit
de8baeb58a
5 changed files with 62 additions and 39 deletions
|
@ -85,6 +85,7 @@ base_sources = Split('''
|
|||
cpu/cpu_exec_context.cc
|
||||
cpu/exetrace.cc
|
||||
cpu/pc_event.cc
|
||||
cpu/quiesce_event.cc
|
||||
cpu/static_inst.cc
|
||||
cpu/sampler/sampler.cc
|
||||
cpu/trace/reader/mem_trace_reader.cc
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#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"
|
||||
|
@ -57,10 +58,12 @@ CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num, System *_sys,
|
|||
: _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) {
|
||||
|
@ -82,7 +85,7 @@ CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num,
|
|||
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));
|
||||
|
@ -91,7 +94,7 @@ CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num,
|
|||
|
||||
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));
|
||||
|
@ -121,23 +124,6 @@ CPUExecContext::dumpFuncProfile()
|
|||
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()
|
||||
{
|
||||
|
@ -189,8 +175,8 @@ CPUExecContext::serialize(ostream &os)
|
|||
|
||||
#if FULL_SYSTEM
|
||||
Tick quiesceEndTick = 0;
|
||||
if (quiesceEvent.scheduled())
|
||||
quiesceEndTick = quiesceEvent.when();
|
||||
if (quiesceEvent->scheduled())
|
||||
quiesceEndTick = quiesceEvent->when();
|
||||
SERIALIZE_SCALAR(quiesceEndTick);
|
||||
|
||||
#endif
|
||||
|
@ -210,7 +196,7 @@ CPUExecContext::unserialize(Checkpoint *cp, const std::string §ion)
|
|||
Tick quiesceEndTick;
|
||||
UNSERIALIZE_SCALAR(quiesceEndTick);
|
||||
if (quiesceEndTick)
|
||||
quiesceEvent.schedule(quiesceEndTick);
|
||||
quiesceEvent->schedule(quiesceEndTick);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -223,7 +209,14 @@ CPUExecContext::activate(int delay)
|
|||
|
||||
lastActivate = curTick;
|
||||
|
||||
if (status() == ExecContext::Unallocated) {
|
||||
cpu->activateWhenReady(thread_num);
|
||||
return;
|
||||
}
|
||||
|
||||
_status = ExecContext::Active;
|
||||
|
||||
// status() == Suspended
|
||||
cpu->activateContext(thread_num, delay);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,23 +135,9 @@ class CPUExecContext
|
|||
Addr profilePC;
|
||||
void dumpFuncProfile();
|
||||
|
||||
/** Event for timing out quiesce instruction */
|
||||
struct EndQuiesceEvent : public Event
|
||||
{
|
||||
/** A pointer to the execution context that is quiesced */
|
||||
CPUExecContext *cpuXC;
|
||||
Event *quiesceEvent;
|
||||
|
||||
EndQuiesceEvent(CPUExecContext *_cpuXC);
|
||||
|
||||
/** Event process to occur at interrupt*/
|
||||
virtual void process();
|
||||
|
||||
/** Event description */
|
||||
virtual const char *description();
|
||||
};
|
||||
EndQuiesceEvent quiesceEvent;
|
||||
|
||||
Event *getQuiesceEvent() { return &quiesceEvent; }
|
||||
Event *getQuiesceEvent() { return quiesceEvent; }
|
||||
|
||||
Tick readLastActivate() { return lastActivate; }
|
||||
|
||||
|
|
20
cpu/quiesce_event.cc
Normal file
20
cpu/quiesce_event.cc
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
#include "cpu/exec_context.hh"
|
||||
#include "cpu/quiesce_event.hh"
|
||||
|
||||
EndQuiesceEvent::EndQuiesceEvent(ExecContext *_xc)
|
||||
: Event(&mainEventQueue), xc(_xc)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
EndQuiesceEvent::process()
|
||||
{
|
||||
xc->activate();
|
||||
}
|
||||
|
||||
const char*
|
||||
EndQuiesceEvent::description()
|
||||
{
|
||||
return "End Quiesce Event.";
|
||||
}
|
23
cpu/quiesce_event.hh
Normal file
23
cpu/quiesce_event.hh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef __CPU_QUIESCE_EVENT_HH__
|
||||
#define __CPU_QUIESCE_EVENT_HH__
|
||||
|
||||
#include "sim/eventq.hh"
|
||||
|
||||
class ExecContext;
|
||||
|
||||
/** Event for timing out quiesce instruction */
|
||||
struct EndQuiesceEvent : public Event
|
||||
{
|
||||
/** A pointer to the execution context that is quiesced */
|
||||
ExecContext *xc;
|
||||
|
||||
EndQuiesceEvent(ExecContext *_xc);
|
||||
|
||||
/** Event process to occur at interrupt*/
|
||||
virtual void process();
|
||||
|
||||
/** Event description */
|
||||
virtual const char *description();
|
||||
};
|
||||
|
||||
#endif // __CPU_QUIESCE_EVENT_HH__
|
Loading…
Reference in a new issue