diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2003-10-29 00:41:24 -0800 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2003-10-29 00:41:24 -0800 |
commit | 1511370d09a2dc93a9f7f6154440d28ed6309b49 (patch) | |
tree | 9d35d22a257bb64628e3b501beeaaa5b9977fd08 | |
parent | a0f3ee7e1770138edd4ee65a2ce6ba2a017d792e (diff) | |
download | gem5-1511370d09a2dc93a9f7f6154440d28ed6309b49.tar.xz |
More progress on checkpointing... we can now write out a checkpoint and read it back in,
though most objects don't actually serialize any data.
arch/alpha/alpha_memory.cc:
arch/alpha/alpha_memory.hh:
arch/alpha/isa_traits.hh:
cpu/exec_context.cc:
cpu/exec_context.hh:
cpu/simple_cpu/simple_cpu.hh:
dev/alpha_access.h:
dev/alpha_console.cc:
dev/alpha_console.hh:
dev/console.cc:
dev/console.hh:
Change unserialize param from IniFile& to const IniFile*.
cpu/simple_cpu/simple_cpu.cc:
Change unserialize param from IniFile& to const IniFile*.
Make unserialize call ExecContext::unserialize.
sim/eventq.cc:
Rename MainEventQueue (no spaces) for easier parsing in checkpoints.
Disable event serialization for now, so we can focus on the easy stuff.
sim/serialize.cc:
Change paramIn and arrayParamIn param from IniFile& to const IniFile*.
sim/serialize.hh:
Change unserialize, paramIn, and arrayParamIn params from IniFile& to const IniFile*.
--HG--
extra : convert_revision : 6e8853ed375eddec0e140c95a01dd51bd225f7b9
-rw-r--r-- | arch/alpha/alpha_memory.cc | 2 | ||||
-rw-r--r-- | arch/alpha/alpha_memory.hh | 2 | ||||
-rw-r--r-- | arch/alpha/isa_traits.hh | 2 | ||||
-rw-r--r-- | cpu/exec_context.cc | 2 | ||||
-rw-r--r-- | cpu/exec_context.hh | 2 | ||||
-rw-r--r-- | cpu/simple_cpu/simple_cpu.cc | 17 | ||||
-rw-r--r-- | cpu/simple_cpu/simple_cpu.hh | 2 | ||||
-rw-r--r-- | dev/alpha_access.h | 2 | ||||
-rw-r--r-- | dev/alpha_console.cc | 4 | ||||
-rw-r--r-- | dev/alpha_console.hh | 2 | ||||
-rw-r--r-- | dev/console.cc | 4 | ||||
-rw-r--r-- | dev/console.hh | 2 | ||||
-rw-r--r-- | sim/eventq.cc | 6 | ||||
-rw-r--r-- | sim/serialize.cc | 28 | ||||
-rw-r--r-- | sim/serialize.hh | 6 |
15 files changed, 36 insertions, 47 deletions
diff --git a/arch/alpha/alpha_memory.cc b/arch/alpha/alpha_memory.cc index 82dd2afa5..2aad41cea 100644 --- a/arch/alpha/alpha_memory.cc +++ b/arch/alpha/alpha_memory.cc @@ -241,7 +241,7 @@ AlphaTlb::serialize(ostream &os) } void -AlphaTlb::unserialize(IniFile &db, const string §ion) +AlphaTlb::unserialize(const IniFile *db, const string §ion) { UNSERIALIZE_MEMBER(size); UNSERIALIZE_MEMBER(nlu); diff --git a/arch/alpha/alpha_memory.hh b/arch/alpha/alpha_memory.hh index c94ee26c3..e6637893c 100644 --- a/arch/alpha/alpha_memory.hh +++ b/arch/alpha/alpha_memory.hh @@ -74,7 +74,7 @@ class AlphaTlb : public SimObject // Checkpointing virtual void serialize(std::ostream &os); - virtual void unserialize(IniFile &db, const std::string §ion); + virtual void unserialize(const IniFile *db, const std::string §ion); }; diff --git a/arch/alpha/isa_traits.hh b/arch/alpha/isa_traits.hh index 5e2dac9f3..e27841c3c 100644 --- a/arch/alpha/isa_traits.hh +++ b/arch/alpha/isa_traits.hh @@ -225,7 +225,7 @@ class AlphaISA static void serializeSpecialRegs(const Serializeable::Proxy &proxy, const RegFile ®s); - static void unserializeSpecialRegs(IniFile &db, + static void unserializeSpecialRegs(const IniFile *db, const std::string &category, ConfigNode *node, RegFile ®s); diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc index 8cfd0a0ea..ed6360649 100644 --- a/cpu/exec_context.cc +++ b/cpu/exec_context.cc @@ -106,7 +106,7 @@ ExecContext::serialize(ostream &os) void -ExecContext::unserialize(IniFile &db, const std::string §ion) +ExecContext::unserialize(const IniFile *db, const std::string §ion) { UNSERIALIZE_ARRAY(regs.intRegFile, NumIntRegs); UNSERIALIZE_ARRAY(regs.floatRegFile.q, NumFloatRegs); diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index 285154ed0..6938b369f 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -142,7 +142,7 @@ class ExecContext void regStats(const std::string &name); void serialize(std::ostream &os); - void unserialize(IniFile &db, const std::string §ion); + void unserialize(const IniFile *db, const std::string §ion); #ifdef FULL_SYSTEM bool validInstAddr(Addr addr) { return true; } diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc index 83e9e1fa2..27576d558 100644 --- a/cpu/simple_cpu/simple_cpu.cc +++ b/cpu/simple_cpu/simple_cpu.cc @@ -246,22 +246,9 @@ SimpleCPU::serialize(ostream &os) } void -SimpleCPU::unserialize(IniFile &db, const string &category) +SimpleCPU::unserialize(const IniFile *db, const string &category) { - string data; - - for (int i = 0; i < NumIntRegs; i++) { - stringstream buf; - ccprintf(buf, "R%02d", i); - db.findDefault(category, buf.str(), data); - to_number(data,xc->regs.intRegFile[i]); - } - for (int i = 0; i < NumFloatRegs; i++) { - stringstream buf; - ccprintf(buf, "F%02d", i); - db.findDefault(category, buf.str(), data); - to_number(data.c_str(), xc->regs.floatRegFile.q[i]); - } + xc->unserialize(db, category); // Read in Special registers diff --git a/cpu/simple_cpu/simple_cpu.hh b/cpu/simple_cpu/simple_cpu.hh index fa7386106..aee8159ce 100644 --- a/cpu/simple_cpu/simple_cpu.hh +++ b/cpu/simple_cpu/simple_cpu.hh @@ -260,7 +260,7 @@ class SimpleCPU : public BaseCPU void processCacheCompletion(); virtual void serialize(std::ostream &os); - virtual void unserialize(IniFile &db, const std::string §ion); + virtual void unserialize(const IniFile *db, const std::string §ion); template <class T> Fault read(Addr addr, T& data, unsigned flags); diff --git a/dev/alpha_access.h b/dev/alpha_access.h index 4bba39c4f..c145fa2a3 100644 --- a/dev/alpha_access.h +++ b/dev/alpha_access.h @@ -82,7 +82,7 @@ struct AlphaAccess #ifndef CONSOLE void serialize(std::ostream &os); - void unserialize(IniFile &db, const std::string §ion); + void unserialize(const IniFile *db, const std::string §ion); #endif }; diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc index 00dab4bad..9bf74bce4 100644 --- a/dev/alpha_console.cc +++ b/dev/alpha_console.cc @@ -188,7 +188,7 @@ AlphaAccess::serialize(ostream &os) } void -AlphaAccess::unserialize(IniFile &db, const std::string §ion) +AlphaAccess::unserialize(const IniFile *db, const std::string §ion) { UNSERIALIZE_MEMBER(last_offset); UNSERIALIZE_MEMBER(version); @@ -216,7 +216,7 @@ AlphaConsole::serialize(ostream &os) } void -AlphaConsole::unserialize(IniFile &db, const std::string §ion) +AlphaConsole::unserialize(const IniFile *db, const std::string §ion) { alphaAccess->unserialize(db, section); } diff --git a/dev/alpha_console.hh b/dev/alpha_console.hh index caa571cec..e4aeb2417 100644 --- a/dev/alpha_console.hh +++ b/dev/alpha_console.hh @@ -101,7 +101,7 @@ class AlphaConsole : public MmapDevice * standard serialization routines for checkpointing */ virtual void serialize(std::ostream &os); - virtual void unserialize(IniFile &db, const std::string §ion); + virtual void unserialize(const IniFile *db, const std::string §ion); }; #endif // __ALPHA_CONSOLE_HH__ diff --git a/dev/console.cc b/dev/console.cc index a84f4a666..749add532 100644 --- a/dev/console.cc +++ b/dev/console.cc @@ -316,13 +316,11 @@ SimConsole::setInt(int bits) void SimConsole::serialize(ostream &os) { - panic("Unimplemented"); } void -SimConsole::unserialize(IniFile &db, const std::string §ion) +SimConsole::unserialize(const IniFile *db, const std::string §ion) { - panic("Unimplemented"); } diff --git a/dev/console.hh b/dev/console.hh index 5d9ea5302..6746f90b6 100644 --- a/dev/console.hh +++ b/dev/console.hh @@ -129,7 +129,7 @@ class SimConsole : public SimObject void setInt(int bits); virtual void serialize(std::ostream &os); - virtual void unserialize(IniFile &db, const std::string §ion); + virtual void unserialize(const IniFile *db, const std::string §ion); }; class ConsoleListener : public SimObject diff --git a/sim/eventq.cc b/sim/eventq.cc index da9e85eeb..7285f63e8 100644 --- a/sim/eventq.cc +++ b/sim/eventq.cc @@ -50,7 +50,7 @@ const string Event::defaultName("event"); // Events on this queue are processed at the *beginning* of each // cycle, before the pipeline simulation is performed. // -EventQueue mainEventQueue("Main Event Queue"); +EventQueue mainEventQueue("MainEventQueue"); void EventQueue::insert(Event *event) @@ -121,6 +121,7 @@ EventQueue::serviceOne() void EventQueue::nameChildren() { +#if 0 int j = 0; Event *event = head; @@ -131,11 +132,13 @@ EventQueue::nameChildren() event = event->next; } +#endif } void EventQueue::serialize(ostream &os) { +#if 0 string objects = ""; Event *event = head; @@ -148,6 +151,7 @@ EventQueue::serialize(ostream &os) } nameOut(os, "Serialized"); SERIALIZE_MEMBER(objects); +#endif } void diff --git a/sim/serialize.cc b/sim/serialize.cc index b2a50154f..00321b932 100644 --- a/sim/serialize.cc +++ b/sim/serialize.cc @@ -88,11 +88,11 @@ paramOut(ostream &os, const std::string &name, const T& param) template <class T> void -paramIn(IniFile &db, const std::string §ion, +paramIn(const IniFile *db, const std::string §ion, const std::string &name, T& param) { std::string str; - if (!db.find(section, name, str) || !parseParam(str, param)) { + if (!db->find(section, name, str) || !parseParam(str, param)) { fatal("Can't unserialize '%s:%s'\n", section, name); } } @@ -116,11 +116,11 @@ arrayParamOut(ostream &os, const std::string &name, template <class T> void -arrayParamIn(IniFile &db, const std::string §ion, +arrayParamIn(const IniFile *db, const std::string §ion, const std::string &name, T *param, int size) { std::string str; - if (!db.find(section, name, str)) { + if (!db->find(section, name, str)) { fatal("Can't unserialize '%s:%s'\n", section, name); } @@ -159,17 +159,17 @@ arrayParamIn(IniFile &db, const std::string §ion, } -#define INSTANTIATE_PARAM_TEMPLATES(type) \ -template void \ +#define INSTANTIATE_PARAM_TEMPLATES(type) \ +template void \ paramOut(ostream &os, const std::string &name, const type ¶m); \ -template void \ -paramIn(IniFile &db, const std::string §ion, \ - const std::string &name, type & param); \ -template void \ -arrayParamOut(ostream &os, const std::string &name, \ - const type *param, int size); \ -template void \ -arrayParamIn(IniFile &db, const std::string §ion, \ +template void \ +paramIn(const IniFile *db, const std::string §ion, \ + const std::string &name, type & param); \ +template void \ +arrayParamOut(ostream &os, const std::string &name, \ + const type *param, int size); \ +template void \ +arrayParamIn(const IniFile *db, const std::string §ion, \ const std::string &name, type *param, int size); diff --git a/sim/serialize.hh b/sim/serialize.hh index 5ebbfaba5..668e654b7 100644 --- a/sim/serialize.hh +++ b/sim/serialize.hh @@ -47,7 +47,7 @@ template <class T> void paramOut(std::ostream &os, const std::string &name, const T& param); template <class T> -void paramIn(IniFile &db, const std::string §ion, +void paramIn(const IniFile *db, const std::string §ion, const std::string &name, T& param); template <class T> @@ -55,7 +55,7 @@ void arrayParamOut(std::ostream &os, const std::string &name, const T *param, int size); template <class T> -void arrayParamIn(IniFile &db, const std::string §ion, +void arrayParamIn(const IniFile *db, const std::string §ion, const std::string &name, T *param, int size); // @@ -103,7 +103,7 @@ class Serializeable virtual void nameChildren() {} virtual void serialize(std::ostream& os) {} - virtual void unserialize(IniFile &db, const std::string §ion) {} + virtual void unserialize(const IniFile *db, const std::string §ion) {} }; class Serializer |