diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:52 -0500 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:52 -0500 |
commit | 009970f59b86eac6c9a35eeb175dd9e3a3079d13 (patch) | |
tree | 03119f68fd1e03ff753954b63722b916b39f6737 /src/cpu/simple/base.cc | |
parent | 5fb00e1df6b2b7d9db472d0c25765263ed1b839f (diff) | |
download | gem5-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/simple/base.cc')
-rw-r--r-- | src/cpu/simple/base.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index da965450a..13e08a6cb 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2011 ARM Limited + * Copyright (c) 2010-2012 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -283,22 +283,21 @@ BaseSimpleCPU::resetStats() } void -BaseSimpleCPU::serialize(ostream &os) +BaseSimpleCPU::serializeThread(ostream &os, ThreadID tid) { - SERIALIZE_ENUM(_status); - BaseCPU::serialize(os); -// SERIALIZE_SCALAR(inst); - nameOut(os, csprintf("%s.xc.0", name())); + assert(_status == Idle || _status == Running); + assert(tid == 0); + thread->serialize(os); } void -BaseSimpleCPU::unserialize(Checkpoint *cp, const string §ion) +BaseSimpleCPU::unserializeThread(Checkpoint *cp, const string §ion, + ThreadID tid) { - UNSERIALIZE_ENUM(_status); - BaseCPU::unserialize(cp, section); -// UNSERIALIZE_SCALAR(inst); - thread->unserialize(cp, csprintf("%s.xc.0", section)); + if (tid != 0) + fatal("Trying to load more than one thread into a SimpleCPU\n"); + thread->unserialize(cp, section); } void |