diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2003-10-28 12:55:12 -0800 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2003-10-28 12:55:12 -0800 |
commit | b90f810575679442d78c0e9cd0c98a057ba4871b (patch) | |
tree | 8882e14d0f8cbee6f7c630ecb2408b62974a32d2 /cpu | |
parent | cec7f73abf841a65bdce38d6eb67a643e4879335 (diff) | |
download | gem5-b90f810575679442d78c0e9cd0c98a057ba4871b.tar.xz |
Revamp serialization to make it easier.
--HG--
extra : convert_revision : c57a538d7cf606dbdf5fa244f92da46bd830e335
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/exec_context.cc | 16 | ||||
-rw-r--r-- | cpu/exec_context.hh | 4 | ||||
-rw-r--r-- | cpu/simple_cpu/simple_cpu.cc | 27 | ||||
-rw-r--r-- | cpu/simple_cpu/simple_cpu.hh | 5 |
4 files changed, 25 insertions, 27 deletions
diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc index a4670f291..8cfd0a0ea 100644 --- a/cpu/exec_context.cc +++ b/cpu/exec_context.cc @@ -98,6 +98,22 @@ ExecContext::takeOverFrom(ExecContext *oldContext) void +ExecContext::serialize(ostream &os) +{ + SERIALIZE_ARRAY(regs.intRegFile, NumIntRegs); + SERIALIZE_ARRAY(regs.floatRegFile.q, NumFloatRegs); +} + + +void +ExecContext::unserialize(IniFile &db, const std::string §ion) +{ + UNSERIALIZE_ARRAY(regs.intRegFile, NumIntRegs); + UNSERIALIZE_ARRAY(regs.floatRegFile.q, NumFloatRegs); +} + + +void ExecContext::setStatus(Status new_status) { #ifdef FULL_SYSTEM diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index f2afaa334..285154ed0 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -31,6 +31,7 @@ #include "sim/host.hh" #include "mem/mem_req.hh" +#include "sim/serialize.hh" // forward declaration: see functional_memory.hh class FunctionalMemory; @@ -140,6 +141,9 @@ class ExecContext void regStats(const std::string &name); + void serialize(std::ostream &os); + void unserialize(IniFile &db, const std::string §ion); + #ifdef FULL_SYSTEM bool validInstAddr(Addr addr) { return true; } bool validDataAddr(Addr addr) { return true; } diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc index 3d0818672..83e9e1fa2 100644 --- a/cpu/simple_cpu/simple_cpu.cc +++ b/cpu/simple_cpu/simple_cpu.cc @@ -240,34 +240,13 @@ SimpleCPU::regStats() } void -SimpleCPU::serialize() +SimpleCPU::serialize(ostream &os) { - nameOut(); - -#ifdef FULL_SYSTEM -#if 0 - // do we need this anymore?? egh - childOut("itb", xc->itb); - childOut("dtb", xc->dtb); - childOut("physmem", physmem); -#endif -#endif - - for (int i = 0; i < NumIntRegs; i++) { - stringstream buf; - ccprintf(buf, "R%02d", i); - paramOut(buf.str(), xc->regs.intRegFile[i]); - } - for (int i = 0; i < NumFloatRegs; i++) { - stringstream buf; - ccprintf(buf, "F%02d", i); - paramOut(buf.str(), xc->regs.floatRegFile.q[i]); - } - // CPUTraitsType::serializeSpecialRegs(getProxy(), xc->regs); + xc->serialize(os); } void -SimpleCPU::unserialize(IniFile &db, const string &category, ConfigNode *node) +SimpleCPU::unserialize(IniFile &db, const string &category) { string data; diff --git a/cpu/simple_cpu/simple_cpu.hh b/cpu/simple_cpu/simple_cpu.hh index 9e2c7fd06..fa7386106 100644 --- a/cpu/simple_cpu/simple_cpu.hh +++ b/cpu/simple_cpu/simple_cpu.hh @@ -259,9 +259,8 @@ class SimpleCPU : public BaseCPU void processCacheCompletion(); - virtual void serialize(); - virtual void unserialize(IniFile &db, const std::string &category, - ConfigNode *node); + virtual void serialize(std::ostream &os); + virtual void unserialize(IniFile &db, const std::string §ion); template <class T> Fault read(Addr addr, T& data, unsigned flags); |