From 4ae02295d59036fa2f9d272ee288e0321bb8257a Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 7 Jan 2013 13:05:44 -0500 Subject: cpu: Unify SimpleCPU and O3 CPU serialization code The O3 CPU used to copy its thread context to a SimpleThread in order to do serialization. This was a bit of a hack involving two static SimpleThread instances and a magic constructor that was only used by the O3 CPU. This patch moves the ThreadContext serialization code into two global procedures that, in addition to the normal serialization parameters, take a ThreadContext reference as a parameter. This allows us to reuse the serialization code in all ThreadContext implementations. --- src/cpu/simple_thread.cc | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/cpu/simple_thread.cc') diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index d2171a0e4..787680224 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -99,12 +99,6 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, kernelStats = new TheISA::Kernel::Statistics(system); } -SimpleThread::SimpleThread() - : ThreadState(NULL, -1, NULL), isa(NULL) -{ - tc = new ProxyThreadContext(this); -} - SimpleThread::~SimpleThread() { delete tc; @@ -175,10 +169,7 @@ void SimpleThread::serialize(ostream &os) { ThreadState::serialize(os); - SERIALIZE_ARRAY(floatRegs.i, TheISA::NumFloatRegs); - SERIALIZE_ARRAY(intRegs, TheISA::NumIntRegs); - _pcState.serialize(os); - // thread_num and cpu_id are deterministic from the config + ::serialize(*tc, os); } @@ -186,10 +177,7 @@ void SimpleThread::unserialize(Checkpoint *cp, const std::string §ion) { ThreadState::unserialize(cp, section); - UNSERIALIZE_ARRAY(floatRegs.i, TheISA::NumFloatRegs); - UNSERIALIZE_ARRAY(intRegs, TheISA::NumIntRegs); - _pcState.unserialize(cp, section); - // thread_num and cpu_id are deterministic from the config + ::unserialize(*tc, cp, section); } void -- cgit v1.2.3