From 074969f8f16110680de05fca64a6be48aedcdfd8 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 17 Jun 2004 15:36:59 -0400 Subject: [PATCH] Serialized cpu interrupts cpu/simple_cpu/simple_cpu.cc: called basecpu serialization --HG-- extra : convert_revision : 1a639b5e3c08e47a5d581c18b2b53fe87bd05b73 --- cpu/base_cpu.cc | 15 +++++++++++++++ cpu/base_cpu.hh | 15 +++++++++++++++ cpu/simple_cpu/simple_cpu.cc | 2 ++ 3 files changed, 32 insertions(+) diff --git a/cpu/base_cpu.cc b/cpu/base_cpu.cc index 944c76ed8..3ee7a3892 100644 --- a/cpu/base_cpu.cc +++ b/cpu/base_cpu.cc @@ -242,6 +242,21 @@ BaseCPU::clear_interrupts() intstatus = 0; } + +void +BaseCPU::serialize(std::ostream &os) +{ + SERIALIZE_ARRAY(interrupts, NumInterruptLevels); + SERIALIZE_SCALAR(intstatus); +} + +void +BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) +{ + UNSERIALIZE_ARRAY(interrupts, NumInterruptLevels); + UNSERIALIZE_SCALAR(intstatus); +} + #endif // FULL_SYSTEM DEFINE_SIM_OBJECT_CLASS_NAME("BaseCPU", BaseCPU) diff --git a/cpu/base_cpu.hh b/cpu/base_cpu.hh index 3e1518cf3..f75f00409 100644 --- a/cpu/base_cpu.hh +++ b/cpu/base_cpu.hh @@ -139,6 +139,21 @@ class BaseCPU : public SimObject #ifdef FULL_SYSTEM System *system; + + + /** + * Serialize this object to the given output stream. + * @param os The stream to serialize to. + */ + virtual void serialize(std::ostream &os); + + /** + * Reconstruct the state of this object from a checkpoint. + * @param cp The checkpoint use. + * @param section The section name of this object + */ + virtual void unserialize(Checkpoint *cp, const std::string §ion); + #endif /** diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc index f2109af51..99e302ca3 100644 --- a/cpu/simple_cpu/simple_cpu.cc +++ b/cpu/simple_cpu/simple_cpu.cc @@ -299,6 +299,7 @@ SimpleCPU::resetStats() void SimpleCPU::serialize(ostream &os) { + BaseCPU::serialize(os); SERIALIZE_ENUM(_status); SERIALIZE_SCALAR(inst); nameOut(os, csprintf("%s.xc", name())); @@ -312,6 +313,7 @@ SimpleCPU::serialize(ostream &os) void SimpleCPU::unserialize(Checkpoint *cp, const string §ion) { + BaseCPU::unserialize(cp, section); UNSERIALIZE_ENUM(_status); UNSERIALIZE_SCALAR(inst); xc->unserialize(cp, csprintf("%s.xc", section)); -- 2.30.2