summaryrefslogtreecommitdiff
path: root/src/cpu/o3/cpu.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:52 -0500
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:52 -0500
commit009970f59b86eac6c9a35eeb175dd9e3a3079d13 (patch)
tree03119f68fd1e03ff753954b63722b916b39f6737 /src/cpu/o3/cpu.cc
parent5fb00e1df6b2b7d9db472d0c25765263ed1b839f (diff)
downloadgem5-009970f59b86eac6c9a35eeb175dd9e3a3079d13.tar.xz
cpu: Unify the serialization code for all of the CPU models
Cleanup the serialization code for the simple CPUs and the O3 CPU. The CPU-specific code has been replaced with a (un)serializeThread that serializes the thread state / context of a specific thread. Assuming that the thread state class uses the CPU-specific thread state uses the base thread state serialization code, this allows us to restore a checkpoint with any of the CPU models.
Diffstat (limited to 'src/cpu/o3/cpu.cc')
-rw-r--r--src/cpu/o3/cpu.cc28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc
index cb17581e5..18c536090 100644
--- a/src/cpu/o3/cpu.cc
+++ b/src/cpu/o3/cpu.cc
@@ -1094,35 +1094,17 @@ FullO3CPU<Impl>::syscall(int64_t callnum, ThreadID tid)
template <class Impl>
void
-FullO3CPU<Impl>::serialize(std::ostream &os)
+FullO3CPU<Impl>::serializeThread(std::ostream &os, ThreadID tid)
{
- Drainable::State so_state(getDrainState());
- SERIALIZE_ENUM(so_state);
- BaseCPU::serialize(os);
- nameOut(os, csprintf("%s.tickEvent", name()));
- tickEvent.serialize(os);
-
- for (ThreadID i = 0; i < thread.size(); i++) {
- nameOut(os, csprintf("%s.xc.%i", name(), i));
- thread[i]->serialize(os);
- }
+ thread[tid]->serialize(os);
}
template <class Impl>
void
-FullO3CPU<Impl>::unserialize(Checkpoint *cp, const std::string &section)
+FullO3CPU<Impl>::unserializeThread(Checkpoint *cp, const std::string &section,
+ ThreadID tid)
{
- Drainable::State so_state;
- UNSERIALIZE_ENUM(so_state);
- BaseCPU::unserialize(cp, section);
- tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
-
- for (ThreadID i = 0; i < thread.size(); i++) {
- thread[i]->unserialize(cp,
- csprintf("%s.xc.%i", section, i));
- if (thread[i]->status() == ThreadContext::Active)
- activateThread(i);
- }
+ thread[tid]->unserialize(cp, section);
}
template <class Impl>