* Authors: Kevin Lim
*/
+#include "arch/kernel_stats.hh"
#include "base/misc.hh"
#include "base/trace.hh"
#include "config/the_isa.hh"
#include "cpu/quiesce_event.hh"
#include "cpu/thread_context.hh"
#include "debug/Context.hh"
+#include "debug/Quiesce.hh"
+#include "params/BaseCPU.hh"
#include "sim/full_system.hh"
void
if (id1 != id2)
panic("CPU ids don't match, one: %d, two: %d", id1, id2);
- id1 = one->contextId();
- id2 = two->contextId();
- if (id1 != id2)
+ const ContextID cid1 = one->contextId();
+ const ContextID cid2 = two->contextId();
+ if (cid1 != cid2)
panic("Context ids don't match, one: %d, two: %d", id1, id2);
}
void
-serialize(ThreadContext &tc, std::ostream &os)
+ThreadContext::quiesce()
+{
+ if (!getCpuPtr()->params()->do_quiesce)
+ return;
+
+ DPRINTF(Quiesce, "%s: quiesce()\n", getCpuPtr()->name());
+
+ suspend();
+ if (getKernelStats())
+ getKernelStats()->quiesce();
+}
+
+
+void
+ThreadContext::quiesceTick(Tick resume)
+{
+ BaseCPU *cpu = getCpuPtr();
+
+ if (!cpu->params()->do_quiesce)
+ return;
+
+ EndQuiesceEvent *quiesceEvent = getQuiesceEvent();
+
+ cpu->reschedule(quiesceEvent, resume, true);
+
+ DPRINTF(Quiesce, "%s: quiesceTick until %lu\n", cpu->name(), resume);
+
+ suspend();
+ if (getKernelStats())
+ getKernelStats()->quiesce();
+}
+
+void
+serialize(ThreadContext &tc, CheckpointOut &cp)
{
using namespace TheISA;
floatRegs[i] = tc.readFloatRegBitsFlat(i);
// This is a bit ugly, but needed to maintain backwards
// compatibility.
- arrayParamOut(os, "floatRegs.i", floatRegs, NumFloatRegs);
+ arrayParamOut(cp, "floatRegs.i", floatRegs, NumFloatRegs);
IntReg intRegs[NumIntRegs];
for (int i = 0; i < NumIntRegs; ++i)
SERIALIZE_ARRAY(ccRegs, NumCCRegs);
#endif
- tc.pcState().serialize(os);
+ tc.pcState().serialize(cp);
// thread_num and cpu_id are deterministic from the config
}
void
-unserialize(ThreadContext &tc, Checkpoint *cp, const std::string §ion)
+unserialize(ThreadContext &tc, CheckpointIn &cp)
{
using namespace TheISA;
FloatRegBits floatRegs[NumFloatRegs];
// This is a bit ugly, but needed to maintain backwards
// compatibility.
- arrayParamIn(cp, section, "floatRegs.i", floatRegs, NumFloatRegs);
+ arrayParamIn(cp, "floatRegs.i", floatRegs, NumFloatRegs);
for (int i = 0; i < NumFloatRegs; ++i)
tc.setFloatRegBitsFlat(i, floatRegs[i]);
#endif
PCState pcState;
- pcState.unserialize(cp, section);
+ pcState.unserialize(cp);
tc.pcState(pcState);
// thread_num and cpu_id are deterministic from the config