diff options
Diffstat (limited to 'src/dev')
104 files changed, 807 insertions, 957 deletions
diff --git a/src/dev/alpha/backdoor.cc b/src/dev/alpha/backdoor.cc index 598620893..ec5765673 100644 --- a/src/dev/alpha/backdoor.cc +++ b/src/dev/alpha/backdoor.cc @@ -252,7 +252,7 @@ AlphaBackdoor::write(PacketPtr pkt) } void -AlphaBackdoor::Access::serialize(ostream &os) +AlphaBackdoor::Access::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(last_offset); SERIALIZE_SCALAR(version); @@ -274,7 +274,7 @@ AlphaBackdoor::Access::serialize(ostream &os) } void -AlphaBackdoor::Access::unserialize(Checkpoint *cp, const std::string §ion) +AlphaBackdoor::Access::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(last_offset); UNSERIALIZE_SCALAR(version); @@ -296,15 +296,15 @@ AlphaBackdoor::Access::unserialize(Checkpoint *cp, const std::string §ion) } void -AlphaBackdoor::serialize(ostream &os) +AlphaBackdoor::serialize(CheckpointOut &cp) const { - alphaAccess->serialize(os); + alphaAccess->serialize(cp); } void -AlphaBackdoor::unserialize(Checkpoint *cp, const std::string §ion) +AlphaBackdoor::unserialize(CheckpointIn &cp) { - alphaAccess->unserialize(cp, section); + alphaAccess->unserialize(cp); } AlphaBackdoor * diff --git a/src/dev/alpha/backdoor.hh b/src/dev/alpha/backdoor.hh index b9d04c7c0..da6201059 100644 --- a/src/dev/alpha/backdoor.hh +++ b/src/dev/alpha/backdoor.hh @@ -74,10 +74,10 @@ class SimpleDisk; class AlphaBackdoor : public BasicPioDevice { protected: - struct Access : public AlphaAccess + struct Access : public AlphaAccess, public Serializable { - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; union { @@ -118,8 +118,8 @@ class AlphaBackdoor : public BasicPioDevice /** * standard serialization routines for checkpointing */ - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __DEV_ALPHA_BACKDOOR_HH__ diff --git a/src/dev/alpha/tsunami.cc b/src/dev/alpha/tsunami.cc index 41a2fef0c..36b1a9ded 100644 --- a/src/dev/alpha/tsunami.cc +++ b/src/dev/alpha/tsunami.cc @@ -114,13 +114,13 @@ Tsunami::calcPciMemAddr(Addr addr) } void -Tsunami::serialize(std::ostream &os) +Tsunami::serialize(CheckpointOut &cp) const { SERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); } void -Tsunami::unserialize(Checkpoint *cp, const std::string §ion) +Tsunami::unserialize(CheckpointIn &cp) { UNSERIALIZE_ARRAY(intr_sum_type, Tsunami::Max_CPUs); } diff --git a/src/dev/alpha/tsunami.hh b/src/dev/alpha/tsunami.hh index 9380864b0..19df8093e 100644 --- a/src/dev/alpha/tsunami.hh +++ b/src/dev/alpha/tsunami.hh @@ -124,18 +124,8 @@ class Tsunami : public Platform */ virtual Addr calcPciMemAddr(Addr addr); - /** - * 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); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __DEV_TSUNAMI_HH__ diff --git a/src/dev/alpha/tsunami_cchip.cc b/src/dev/alpha/tsunami_cchip.cc index 7416de403..d67f4e3fb 100644 --- a/src/dev/alpha/tsunami_cchip.cc +++ b/src/dev/alpha/tsunami_cchip.cc @@ -507,7 +507,7 @@ TsunamiCChip::clearDRIR(uint32_t interrupt) void -TsunamiCChip::serialize(std::ostream &os) +TsunamiCChip::serialize(CheckpointOut &cp) const { SERIALIZE_ARRAY(dim, Tsunami::Max_CPUs); SERIALIZE_ARRAY(dir, Tsunami::Max_CPUs); @@ -517,7 +517,7 @@ TsunamiCChip::serialize(std::ostream &os) } void -TsunamiCChip::unserialize(Checkpoint *cp, const std::string §ion) +TsunamiCChip::unserialize(CheckpointIn &cp) { UNSERIALIZE_ARRAY(dim, Tsunami::Max_CPUs); UNSERIALIZE_ARRAY(dir, Tsunami::Max_CPUs); diff --git a/src/dev/alpha/tsunami_cchip.hh b/src/dev/alpha/tsunami_cchip.hh index e9aca5d5c..fdbe64ef1 100644 --- a/src/dev/alpha/tsunami_cchip.hh +++ b/src/dev/alpha/tsunami_cchip.hh @@ -131,20 +131,8 @@ class TsunamiCChip : public BasicPioDevice */ void reqIPI(uint64_t ipreq); - - /** - * 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); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __TSUNAMI_CCHIP_HH__ diff --git a/src/dev/alpha/tsunami_io.cc b/src/dev/alpha/tsunami_io.cc index 2236546fc..8015ec2fe 100644 --- a/src/dev/alpha/tsunami_io.cc +++ b/src/dev/alpha/tsunami_io.cc @@ -251,7 +251,7 @@ TsunamiIO::clearPIC(uint8_t bitvector) } void -TsunamiIO::serialize(ostream &os) +TsunamiIO::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(rtcAddr); SERIALIZE_SCALAR(timerData); @@ -263,12 +263,12 @@ TsunamiIO::serialize(ostream &os) SERIALIZE_SCALAR(picInterrupting); // Serialize the timers - pitimer.serialize("pitimer", os); - rtc.serialize("rtc", os); + pitimer.serialize("pitimer", cp); + rtc.serialize("rtc", cp); } void -TsunamiIO::unserialize(Checkpoint *cp, const string §ion) +TsunamiIO::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(rtcAddr); UNSERIALIZE_SCALAR(timerData); @@ -280,8 +280,8 @@ TsunamiIO::unserialize(Checkpoint *cp, const string §ion) UNSERIALIZE_SCALAR(picInterrupting); // Unserialize the timers - pitimer.unserialize("pitimer", cp, section); - rtc.unserialize("rtc", cp, section); + pitimer.unserialize("pitimer", cp); + rtc.unserialize("rtc", cp); } void diff --git a/src/dev/alpha/tsunami_io.hh b/src/dev/alpha/tsunami_io.hh index f242c9e2a..2b7f5484e 100644 --- a/src/dev/alpha/tsunami_io.hh +++ b/src/dev/alpha/tsunami_io.hh @@ -138,18 +138,8 @@ class TsunamiIO : public BasicPioDevice */ void clearPIC(uint8_t bitvector); - /** - * 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); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** * Start running. diff --git a/src/dev/alpha/tsunami_pchip.cc b/src/dev/alpha/tsunami_pchip.cc index 328699f9f..cfd1e69e4 100644 --- a/src/dev/alpha/tsunami_pchip.cc +++ b/src/dev/alpha/tsunami_pchip.cc @@ -324,7 +324,7 @@ TsunamiPChip::calcMemAddr(Addr addr) } void -TsunamiPChip::serialize(std::ostream &os) +TsunamiPChip::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(pctl); SERIALIZE_ARRAY(wsba, 4); @@ -333,7 +333,7 @@ TsunamiPChip::serialize(std::ostream &os) } void -TsunamiPChip::unserialize(Checkpoint *cp, const std::string §ion) +TsunamiPChip::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(pctl); UNSERIALIZE_ARRAY(wsba, 4); diff --git a/src/dev/alpha/tsunami_pchip.hh b/src/dev/alpha/tsunami_pchip.hh index 3e32db989..0eb992131 100644 --- a/src/dev/alpha/tsunami_pchip.hh +++ b/src/dev/alpha/tsunami_pchip.hh @@ -89,18 +89,8 @@ class TsunamiPChip : public BasicPioDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - /** - * 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); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __TSUNAMI_PCHIP_HH__ diff --git a/src/dev/arm/energy_ctrl.cc b/src/dev/arm/energy_ctrl.cc index b77eaba3b..0e6925852 100644 --- a/src/dev/arm/energy_ctrl.cc +++ b/src/dev/arm/energy_ctrl.cc @@ -216,7 +216,7 @@ EnergyCtrl::write(PacketPtr pkt) } void -EnergyCtrl::serialize(std::ostream &os) +EnergyCtrl::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(domainID); SERIALIZE_SCALAR(domainIDIndexToRead); @@ -228,7 +228,7 @@ EnergyCtrl::serialize(std::ostream &os) } void -EnergyCtrl::unserialize(Checkpoint *cp, const std::string §ion) +EnergyCtrl::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(domainID); UNSERIALIZE_SCALAR(domainIDIndexToRead); diff --git a/src/dev/arm/energy_ctrl.hh b/src/dev/arm/energy_ctrl.hh index 54a690679..a1a362879 100644 --- a/src/dev/arm/energy_ctrl.hh +++ b/src/dev/arm/energy_ctrl.hh @@ -132,8 +132,8 @@ class EnergyCtrl : public BasicPioDevice */ virtual Tick write(PacketPtr pkt); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; void startup(); void init(); diff --git a/src/dev/arm/flash_device.cc b/src/dev/arm/flash_device.cc index eaa839178..96f8f0566 100644 --- a/src/dev/arm/flash_device.cc +++ b/src/dev/arm/flash_device.cc @@ -518,7 +518,7 @@ FlashDevice::regStats() */ void -FlashDevice::serialize(std::ostream &os) +FlashDevice::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(planeMask); @@ -551,7 +551,7 @@ FlashDevice::serialize(std::ostream &os) */ void -FlashDevice::unserialize(Checkpoint *cp, const std::string §ion) +FlashDevice::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(planeMask); diff --git a/src/dev/arm/flash_device.hh b/src/dev/arm/flash_device.hh index 8dc4ba04a..330299451 100644 --- a/src/dev/arm/flash_device.hh +++ b/src/dev/arm/flash_device.hh @@ -64,8 +64,9 @@ class FlashDevice : public AbstractNVM /** Checkpoint functions*/ unsigned int drain(DrainManager *dm); void checkDrain(); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; private: /** Defines the possible actions to the flash*/ diff --git a/src/dev/arm/generic_timer.cc b/src/dev/arm/generic_timer.cc index 41cb4bada..173855b88 100644 --- a/src/dev/arm/generic_timer.cc +++ b/src/dev/arm/generic_timer.cc @@ -66,7 +66,7 @@ SystemCounter::setFreq(uint32_t freq) } void -SystemCounter::serialize(std::ostream &os) const +SystemCounter::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(_regCntkctl); SERIALIZE_SCALAR(_freq); @@ -75,8 +75,7 @@ SystemCounter::serialize(std::ostream &os) const } void -SystemCounter::unserialize(Checkpoint *cp, - const std::string §ion) +SystemCounter::unserialize(CheckpointIn &cp) { // We didn't handle CNTKCTL in this class before, assume it's zero // if it isn't present. @@ -175,9 +174,9 @@ ArchTimer::value() const } void -ArchTimer::serialize(std::ostream &os) const +ArchTimer::serialize(CheckpointOut &cp) const { - paramOut(os, "control_serial", _control); + paramOut(cp, "control_serial", _control); SERIALIZE_SCALAR(_counterLimit); SERIALIZE_SCALAR(_offset); @@ -190,10 +189,9 @@ ArchTimer::serialize(std::ostream &os) const } void -ArchTimer::unserialize(Checkpoint *cp, - const std::string §ion) +ArchTimer::unserialize(CheckpointIn &cp) { - paramIn(cp, section, "control_serial", _control); + paramIn(cp, "control_serial", _control); // We didn't serialize an offset before we added support for the // virtual timer. Consider it optional to maintain backwards // compatibility. @@ -240,28 +238,26 @@ GenericTimer::GenericTimer(GenericTimerParams *p) } void -GenericTimer::serialize(std::ostream &os) +GenericTimer::serialize(CheckpointOut &cp) const { - paramOut(os, "cpu_count", timers.size()); + paramOut(cp, "cpu_count", timers.size()); - nameOut(os, csprintf("%s.sys_counter", name())); - systemCounter.serialize(os); + systemCounter.serializeSection(cp, "sys_counter"); for (int i = 0; i < timers.size(); ++i) { - CoreTimers &core(getTimers(i)); - - nameOut(os, core.phys.name()); - core.phys.serialize(os); + const CoreTimers &core(*timers[i]); - nameOut(os, core.virt.name()); - core.virt.serialize(os); + // This should really be phys_timerN, but we are stuck with + // arch_timer for backwards compatibility. + core.phys.serializeSection(cp, csprintf("arch_timer%d", i)); + core.virt.serializeSection(cp, csprintf("virt_timer%d", i)); } } void -GenericTimer::unserialize(Checkpoint *cp, const std::string §ion) +GenericTimer::unserialize(CheckpointIn &cp) { - systemCounter.unserialize(cp, csprintf("%s.sys_counter", section)); + systemCounter.unserializeSection(cp, "sys_counter"); // Try to unserialize the CPU count. Old versions of the timer // model assumed a 8 CPUs, so we fall back to that if the field @@ -278,8 +274,8 @@ GenericTimer::unserialize(Checkpoint *cp, const std::string §ion) CoreTimers &core(getTimers(i)); // This should really be phys_timerN, but we are stuck with // arch_timer for backwards compatibility. - core.phys.unserialize(cp, csprintf("%s.arch_timer%d", section, i)); - core.virt.unserialize(cp, csprintf("%s.virt_timer%d", section, i)); + core.phys.unserializeSection(cp, csprintf("arch_timer%d", i)); + core.virt.unserializeSection(cp, csprintf("virt_timer%d", i)); } } @@ -498,24 +494,20 @@ GenericTimerMem::GenericTimerMem(GenericTimerMemParams *p) } void -GenericTimerMem::serialize(std::ostream &os) +GenericTimerMem::serialize(CheckpointOut &cp) const { - paramOut(os, "timer_count", 1); - - nameOut(os, csprintf("%s.sys_counter", name())); - systemCounter.serialize(os); + paramOut(cp, "timer_count", 1); - nameOut(os, physTimer.name()); - physTimer.serialize(os); + systemCounter.serializeSection(cp, "sys_counter"); - nameOut(os, virtTimer.name()); - virtTimer.serialize(os); + physTimer.serializeSection(cp, "phys_timer0"); + virtTimer.serializeSection(cp, "virt_timer0"); } void -GenericTimerMem::unserialize(Checkpoint *cp, const std::string §ion) +GenericTimerMem::unserialize(CheckpointIn &cp) { - systemCounter.unserialize(cp, csprintf("%s.sys_counter", section)); + systemCounter.unserializeSection(cp, "sys_counter"); unsigned timer_count; UNSERIALIZE_SCALAR(timer_count); @@ -524,8 +516,8 @@ GenericTimerMem::unserialize(Checkpoint *cp, const std::string §ion) if (timer_count != 1) panic("Incompatible checkpoint: Only one set of timers supported"); - physTimer.unserialize(cp, csprintf("%s.phys_timer0", section)); - virtTimer.unserialize(cp, csprintf("%s.virt_timer0", section)); + physTimer.unserializeSection(cp, "phys_timer0"); + virtTimer.unserializeSection(cp, "virt_timer0"); } Tick diff --git a/src/dev/arm/generic_timer.hh b/src/dev/arm/generic_timer.hh index d8f7f54e2..97823f05f 100644 --- a/src/dev/arm/generic_timer.hh +++ b/src/dev/arm/generic_timer.hh @@ -58,7 +58,7 @@ class GenericTimerMemParams; /// Global system counter. It is shared by the architected timers. /// @todo: implement memory-mapped controls -class SystemCounter +class SystemCounter : public Serializable { protected: /// Counter frequency (as specified by CNTFRQ). @@ -93,8 +93,8 @@ class SystemCounter void setKernelControl(uint32_t val) { _regCntkctl = val; } uint32_t getKernelControl() { return _regCntkctl; } - void serialize(std::ostream &os) const; - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; private: // Disable copying @@ -102,7 +102,7 @@ class SystemCounter }; /// Per-CPU architected timer. -class ArchTimer +class ArchTimer : public Serializable { public: class Interrupt @@ -189,8 +189,8 @@ class ArchTimer /// Returns the value of the counter which this timer relies on. uint64_t value() const; - void serialize(std::ostream &os) const; - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; private: // Disable copying @@ -202,8 +202,8 @@ class GenericTimer : public SimObject public: GenericTimer(GenericTimerParams *p); - void serialize(std::ostream &os) M5_ATTR_OVERRIDE; - void unserialize(Checkpoint *cp, const std::string &sec) M5_ATTR_OVERRIDE; + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; public: void setMiscReg(int misc_reg, unsigned cpu, ArmISA::MiscReg val); @@ -279,8 +279,8 @@ class GenericTimerMem : public PioDevice public: GenericTimerMem(GenericTimerMemParams *p); - void serialize(std::ostream &os) M5_ATTR_OVERRIDE; - void unserialize(Checkpoint *cp, const std::string &sec) M5_ATTR_OVERRIDE; + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; public: // PioDevice AddrRangeList getAddrRanges() const M5_ATTR_OVERRIDE { return addrRanges; } diff --git a/src/dev/arm/gic_pl390.cc b/src/dev/arm/gic_pl390.cc index b4dc37682..5a21f6cec 100644 --- a/src/dev/arm/gic_pl390.cc +++ b/src/dev/arm/gic_pl390.cc @@ -741,7 +741,7 @@ Pl390::getAddrRanges() const void -Pl390::serialize(std::ostream &os) +Pl390::serialize(CheckpointOut &cp) const { DPRINTF(Checkpoint, "Serializing Arm GIC\n"); @@ -781,7 +781,7 @@ Pl390::serialize(std::ostream &os) } void -Pl390::unserialize(Checkpoint *cp, const std::string §ion) +Pl390::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing Arm GIC\n"); diff --git a/src/dev/arm/gic_pl390.hh b/src/dev/arm/gic_pl390.hh index 2621e1a27..1adad6c9a 100644 --- a/src/dev/arm/gic_pl390.hh +++ b/src/dev/arm/gic_pl390.hh @@ -300,8 +300,8 @@ class Pl390 : public BaseGic void driveIrqEn(bool state); /** @} */ - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; protected: /** Handle a read to the distributor poriton of the GIC diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc index 3fc30f16d..afeef7637 100644 --- a/src/dev/arm/hdlcd.cc +++ b/src/dev/arm/hdlcd.cc @@ -580,7 +580,7 @@ HDLcd::dmaDone(DmaDoneEvent *event) } void -HDLcd::serialize(std::ostream &os) +HDLcd::serialize(CheckpointOut &cp) const { DPRINTF(HDLcd, "Serializing ARM HDLCD\n"); @@ -641,7 +641,7 @@ HDLcd::serialize(std::ostream &os) SERIALIZE_SCALAR(dmaPendingNum); SERIALIZE_SCALAR(frameUnderrun); - arrayParamOut(os, "virtualDisplayBuffer", virtualDisplayBuffer); + arrayParamOut(cp, "virtualDisplayBuffer", virtualDisplayBuffer); SERIALIZE_SCALAR(pixelBufferSize); SERIALIZE_SCALAR(pixelIndex); @@ -678,12 +678,12 @@ HDLcd::serialize(std::ostream &os) dma_done_event_burst_len[x] = dmaDoneEventAll[x].scheduled() ? dmaDoneEventAll[x].getTransactionSize() : 0; } - arrayParamOut(os, "dma_done_event_tick", dma_done_event_tick); - arrayParamOut(os, "dma_done_event_burst_length", dma_done_event_burst_len); + arrayParamOut(cp, "dma_done_event_tick", dma_done_event_tick); + arrayParamOut(cp, "dma_done_event_burst_length", dma_done_event_burst_len); } void -HDLcd::unserialize(Checkpoint *cp, const std::string §ion) +HDLcd::unserialize(CheckpointIn &cp) { uint32_t version_serial, int_rawstat_serial, int_clear_serial, int_mask_serial, int_status_serial, fb_line_count_serial, @@ -753,7 +753,7 @@ HDLcd::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(frameUnderrun); UNSERIALIZE_SCALAR(dmaBytesInFlight); - arrayParamIn(cp, section, "virtualDisplayBuffer", virtualDisplayBuffer); + arrayParamIn(cp, "virtualDisplayBuffer", virtualDisplayBuffer); UNSERIALIZE_SCALAR(pixelBufferSize); UNSERIALIZE_SCALAR(pixelIndex); @@ -783,8 +783,8 @@ HDLcd::unserialize(Checkpoint *cp, const std::string §ion) vector<Tick> dma_done_event_tick(MAX_OUTSTANDING_DMA_REQ_CAPACITY); vector<Tick> dma_done_event_burst_len(MAX_OUTSTANDING_DMA_REQ_CAPACITY); - arrayParamIn(cp, section, "dma_done_event_tick", dma_done_event_tick); - arrayParamIn(cp, section, "dma_done_event_burst_length", dma_done_event_burst_len); + arrayParamIn(cp, "dma_done_event_tick", dma_done_event_tick); + arrayParamIn(cp, "dma_done_event_burst_length", dma_done_event_burst_len); dmaDoneEventFree.clear(); for (int x = 0; x < MAX_OUTSTANDING_DMA_REQ_CAPACITY; ++x) { if (dma_done_event_tick[x]) { diff --git a/src/dev/arm/hdlcd.hh b/src/dev/arm/hdlcd.hh index 519afeba6..1396c9a8b 100644 --- a/src/dev/arm/hdlcd.hh +++ b/src/dev/arm/hdlcd.hh @@ -502,8 +502,8 @@ class HDLcd: public AmbaDmaDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** * Determine the address ranges that this device responds to. diff --git a/src/dev/arm/kmi.cc b/src/dev/arm/kmi.cc index 2344b4cb5..d96810351 100644 --- a/src/dev/arm/kmi.cc +++ b/src/dev/arm/kmi.cc @@ -308,7 +308,7 @@ Pl050::keyPress(uint32_t key, bool down) } void -Pl050::serialize(std::ostream &os) +Pl050::serialize(CheckpointOut &cp) const { uint8_t ctrlreg = control; SERIALIZE_SCALAR(ctrlreg); @@ -327,11 +327,11 @@ Pl050::serialize(std::ostream &os) SERIALIZE_SCALAR(shiftDown); SERIALIZE_SCALAR(driverInitialized); - arrayParamOut(os, "rxQueue", rxQueue); + SERIALIZE_CONTAINER(rxQueue); } void -Pl050::unserialize(Checkpoint *cp, const std::string §ion) +Pl050::unserialize(CheckpointIn &cp) { uint8_t ctrlreg; UNSERIALIZE_SCALAR(ctrlreg); @@ -355,7 +355,7 @@ Pl050::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(shiftDown); UNSERIALIZE_SCALAR(driverInitialized); - arrayParamIn(cp, section, "rxQueue", rxQueue); + UNSERIALIZE_CONTAINER(rxQueue); } diff --git a/src/dev/arm/kmi.hh b/src/dev/arm/kmi.hh index f9dbfcf76..9b30b3c15 100644 --- a/src/dev/arm/kmi.hh +++ b/src/dev/arm/kmi.hh @@ -157,8 +157,8 @@ class Pl050 : public AmbaIntDevice, public VncKeyboard, public VncMouse virtual void mouseAt(uint16_t x, uint16_t y, uint8_t buttons); virtual void keyPress(uint32_t key, bool down); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __DEV_ARM_PL050_HH__ diff --git a/src/dev/arm/pl011.cc b/src/dev/arm/pl011.cc index 2abd82e96..f0c3d2d98 100644 --- a/src/dev/arm/pl011.cc +++ b/src/dev/arm/pl011.cc @@ -272,7 +272,7 @@ Pl011::setInterrupts(uint16_t ints, uint16_t mask) void -Pl011::serialize(std::ostream &os) +Pl011::serialize(CheckpointOut &cp) const { DPRINTF(Checkpoint, "Serializing Arm PL011\n"); SERIALIZE_SCALAR(control); @@ -282,12 +282,12 @@ Pl011::serialize(std::ostream &os) SERIALIZE_SCALAR(ifls); // Preserve backwards compatibility by giving these silly names. - paramOut(os, "imsc_serial", imsc); - paramOut(os, "rawInt_serial", rawInt); + paramOut(cp, "imsc_serial", imsc); + paramOut(cp, "rawInt_serial", rawInt); } void -Pl011::unserialize(Checkpoint *cp, const std::string §ion) +Pl011::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing Arm PL011\n"); @@ -298,8 +298,8 @@ Pl011::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(ifls); // Preserve backwards compatibility by giving these silly names. - paramIn(cp, section, "imsc_serial", imsc); - paramIn(cp, section, "rawInt_serial", rawInt); + paramIn(cp, "imsc_serial", imsc); + paramIn(cp, "rawInt_serial", rawInt); } Pl011 * diff --git a/src/dev/arm/pl011.hh b/src/dev/arm/pl011.hh index f2587c08d..b0f7d576d 100644 --- a/src/dev/arm/pl011.hh +++ b/src/dev/arm/pl011.hh @@ -60,8 +60,8 @@ class Pl011 : public Uart, public AmbaDevice public: Pl011(const Pl011Params *p); - void serialize(std::ostream &os) M5_ATTR_OVERRIDE; - void unserialize(Checkpoint *cp, const std::string &sec) M5_ATTR_OVERRIDE; + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; public: // PioDevice Tick read(PacketPtr pkt) M5_ATTR_OVERRIDE; diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc index fcce09f50..179f1bf2d 100644 --- a/src/dev/arm/pl111.cc +++ b/src/dev/arm/pl111.cc @@ -547,7 +547,7 @@ Pl111::dmaDone() } void -Pl111::serialize(std::ostream &os) +Pl111::serialize(CheckpointOut &cp) const { DPRINTF(PL111, "Serializing ARM PL111\n"); @@ -633,11 +633,11 @@ Pl111::serialize(std::ostream &os) dma_done_event_tick[x] = dmaDoneEventAll[x].scheduled() ? dmaDoneEventAll[x].when() : 0; } - arrayParamOut(os, "dma_done_event_tick", dma_done_event_tick); + SERIALIZE_CONTAINER(dma_done_event_tick); } void -Pl111::unserialize(Checkpoint *cp, const std::string §ion) +Pl111::unserialize(CheckpointIn &cp) { DPRINTF(PL111, "Unserializing ARM PL111\n"); @@ -731,7 +731,7 @@ Pl111::unserialize(Checkpoint *cp, const std::string §ion) vector<Tick> dma_done_event_tick; dma_done_event_tick.resize(maxOutstandingDma); - arrayParamIn(cp, section, "dma_done_event_tick", dma_done_event_tick); + UNSERIALIZE_CONTAINER(dma_done_event_tick); dmaDoneEventFree.clear(); for (int x = 0; x < maxOutstandingDma; x++) { if (dma_done_event_tick[x]) diff --git a/src/dev/arm/pl111.hh b/src/dev/arm/pl111.hh index 85973bbc7..08d9147a4 100644 --- a/src/dev/arm/pl111.hh +++ b/src/dev/arm/pl111.hh @@ -371,8 +371,8 @@ class Pl111: public AmbaDmaDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** * Determine the address ranges that this device responds to. diff --git a/src/dev/arm/rtc_pl031.cc b/src/dev/arm/rtc_pl031.cc index e619045c2..d5661877c 100644 --- a/src/dev/arm/rtc_pl031.cc +++ b/src/dev/arm/rtc_pl031.cc @@ -192,7 +192,7 @@ PL031::counterMatch() } void -PL031::serialize(std::ostream &os) +PL031::serialize(CheckpointOut &cp) const { DPRINTF(Checkpoint, "Serializing Arm PL031\n"); SERIALIZE_SCALAR(timeVal); @@ -214,7 +214,7 @@ PL031::serialize(std::ostream &os) } void -PL031::unserialize(Checkpoint *cp, const std::string §ion) +PL031::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing Arm PL031\n"); diff --git a/src/dev/arm/rtc_pl031.hh b/src/dev/arm/rtc_pl031.hh index 0f1929d29..406857e70 100644 --- a/src/dev/arm/rtc_pl031.hh +++ b/src/dev/arm/rtc_pl031.hh @@ -125,9 +125,8 @@ class PL031 : public AmbaIntDevice */ virtual Tick write(PacketPtr pkt); - - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; diff --git a/src/dev/arm/rv_ctrl.cc b/src/dev/arm/rv_ctrl.cc index f2b85d513..27ba2e8a6 100644 --- a/src/dev/arm/rv_ctrl.cc +++ b/src/dev/arm/rv_ctrl.cc @@ -248,13 +248,13 @@ RealViewCtrl::write(PacketPtr pkt) } void -RealViewCtrl::serialize(std::ostream &os) +RealViewCtrl::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(flags); } void -RealViewCtrl::unserialize(Checkpoint *cp, const std::string §ion) +RealViewCtrl::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(flags); } diff --git a/src/dev/arm/rv_ctrl.hh b/src/dev/arm/rv_ctrl.hh index adf065631..cae5e2e2c 100644 --- a/src/dev/arm/rv_ctrl.hh +++ b/src/dev/arm/rv_ctrl.hh @@ -136,9 +136,8 @@ class RealViewCtrl : public BasicPioDevice */ virtual Tick write(PacketPtr pkt); - - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; diff --git a/src/dev/arm/timer_cpulocal.cc b/src/dev/arm/timer_cpulocal.cc index de2f99f0a..ac02d099f 100644 --- a/src/dev/arm/timer_cpulocal.cc +++ b/src/dev/arm/timer_cpulocal.cc @@ -335,7 +335,7 @@ CpuLocalTimer::Timer::watchdogAtZero() } void -CpuLocalTimer::Timer::serialize(std::ostream &os) +CpuLocalTimer::Timer::serialize(CheckpointOut &cp) const { DPRINTF(Checkpoint, "Serializing Arm CpuLocalTimer\n"); SERIALIZE_SCALAR(intNumTimer); @@ -373,7 +373,7 @@ CpuLocalTimer::Timer::serialize(std::ostream &os) } void -CpuLocalTimer::Timer::unserialize(Checkpoint *cp, const std::string §ion) +CpuLocalTimer::Timer::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing Arm CpuLocalTimer\n"); @@ -416,20 +416,17 @@ CpuLocalTimer::Timer::unserialize(Checkpoint *cp, const std::string §ion) void -CpuLocalTimer::serialize(std::ostream &os) +CpuLocalTimer::serialize(CheckpointOut &cp) const { - for (int i = 0; i < CPU_MAX; i++) { - nameOut(os, csprintf("%s.timer%d", name(), i)); - localTimer[i].serialize(os); - } + for (int i = 0; i < CPU_MAX; i++) + localTimer[i].serializeSection(cp, csprintf("timer%d", i)); } void -CpuLocalTimer::unserialize(Checkpoint *cp, const std::string §ion) +CpuLocalTimer::unserialize(CheckpointIn &cp) { - for (int i = 0; i < CPU_MAX; i++) { - localTimer[i].unserialize(cp, csprintf("%s.timer%d", section, i)); - } + for (int i = 0; i < CPU_MAX; i++) + localTimer[i].unserializeSection(cp, csprintf("timer%d", i)); } CpuLocalTimer * diff --git a/src/dev/arm/timer_cpulocal.hh b/src/dev/arm/timer_cpulocal.hh index f53f5bc25..73a2d4493 100644 --- a/src/dev/arm/timer_cpulocal.hh +++ b/src/dev/arm/timer_cpulocal.hh @@ -55,7 +55,7 @@ class BaseGic; class CpuLocalTimer : public BasicPioDevice { protected: - class Timer + class Timer : public Serializable { public: @@ -145,8 +145,8 @@ class CpuLocalTimer : public BasicPioDevice /** Handle write for a single timer */ void write(PacketPtr pkt, Addr daddr); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; friend class CpuLocalTimer; }; @@ -186,9 +186,8 @@ class CpuLocalTimer : public BasicPioDevice */ virtual Tick write(PacketPtr pkt); - - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; diff --git a/src/dev/arm/timer_sp804.cc b/src/dev/arm/timer_sp804.cc index 9f7867107..54a5a2516 100644 --- a/src/dev/arm/timer_sp804.cc +++ b/src/dev/arm/timer_sp804.cc @@ -217,7 +217,7 @@ Sp804::Timer::counterAtZero() } void -Sp804::Timer::serialize(std::ostream &os) +Sp804::Timer::serialize(CheckpointOut &cp) const { DPRINTF(Checkpoint, "Serializing Arm Sp804\n"); @@ -239,7 +239,7 @@ Sp804::Timer::serialize(std::ostream &os) } void -Sp804::Timer::unserialize(Checkpoint *cp, const std::string §ion) +Sp804::Timer::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing Arm Sp804\n"); @@ -264,19 +264,17 @@ Sp804::Timer::unserialize(Checkpoint *cp, const std::string §ion) void -Sp804::serialize(std::ostream &os) +Sp804::serialize(CheckpointOut &cp) const { - nameOut(os, csprintf("%s.timer0", name())); - timer0.serialize(os); - nameOut(os, csprintf("%s.timer1", name())); - timer1.serialize(os); + timer0.serializeSection(cp, "timer0"); + timer1.serializeSection(cp, "timer1"); } void -Sp804::unserialize(Checkpoint *cp, const std::string §ion) +Sp804::unserialize(CheckpointIn &cp) { - timer0.unserialize(cp, csprintf("%s.timer0", section)); - timer1.unserialize(cp, csprintf("%s.timer1", section)); + timer0.unserializeSection(cp, "timer0"); + timer1.unserializeSection(cp, "timer1"); } Sp804 * diff --git a/src/dev/arm/timer_sp804.hh b/src/dev/arm/timer_sp804.hh index 03dc20ec1..c5b3bb633 100644 --- a/src/dev/arm/timer_sp804.hh +++ b/src/dev/arm/timer_sp804.hh @@ -52,7 +52,7 @@ class BaseGic; class Sp804 : public AmbaPioDevice { protected: - class Timer + class Timer : public Serializable { public: @@ -121,9 +121,8 @@ class Sp804 : public AmbaPioDevice /** Handle write for a single timer */ void write(PacketPtr pkt, Addr daddr); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; /** Pointer to the GIC for causing an interrupt */ @@ -161,8 +160,8 @@ class Sp804 : public AmbaPioDevice virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; diff --git a/src/dev/arm/ufs_device.cc b/src/dev/arm/ufs_device.cc index d271656cd..02df00e35 100644 --- a/src/dev/arm/ufs_device.cc +++ b/src/dev/arm/ufs_device.cc @@ -2283,11 +2283,11 @@ UFSHostDevice::readGarbage() */ void -UFSHostDevice::serialize(std::ostream &os) +UFSHostDevice::serialize(CheckpointOut &cp) const { - DmaDevice::serialize(os); + DmaDevice::serialize(cp); - uint8_t* temp_HCI_mem = reinterpret_cast<uint8_t*>(&UFSHCIMem); + const uint8_t* temp_HCI_mem = reinterpret_cast<const uint8_t*>(&UFSHCIMem); SERIALIZE_ARRAY(temp_HCI_mem, sizeof(HCIMem)); uint32_t lun_avail = lunAvail; @@ -2300,9 +2300,9 @@ UFSHostDevice::serialize(std::ostream &os) */ void -UFSHostDevice::unserialize(Checkpoint *cp, const std::string §ion) +UFSHostDevice::unserialize(CheckpointIn &cp) { - DmaDevice::unserialize(cp, section); + DmaDevice::unserialize(cp); uint8_t* temp_HCI_mem = reinterpret_cast<uint8_t*>(&UFSHCIMem); UNSERIALIZE_ARRAY(temp_HCI_mem, sizeof(HCIMem)); diff --git a/src/dev/arm/ufs_device.hh b/src/dev/arm/ufs_device.hh index 07f038175..15e983ad8 100644 --- a/src/dev/arm/ufs_device.hh +++ b/src/dev/arm/ufs_device.hh @@ -175,8 +175,8 @@ class UFSHostDevice : public DmaDevice unsigned int drain(DrainManager *dm); void checkDrain(); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; private: /** diff --git a/src/dev/arm/vgic.cc b/src/dev/arm/vgic.cc index 4a63c796a..f4a3e8c3f 100644 --- a/src/dev/arm/vgic.cc +++ b/src/dev/arm/vgic.cc @@ -56,9 +56,6 @@ VGic::VGic(const Params *p) maintIntPosted[x] = false; vIntPosted[x] = false; } - for (int c = 0; c < VGIC_CPU_MAX; c++) { - memset(&vcpuData[c], 0, sizeof(struct vcpuIntData)); - } assert(sys->numRunningContexts() <= VGIC_CPU_MAX); } @@ -437,7 +434,7 @@ VGic::getAddrRanges() const } void -VGic::serialize(std::ostream &os) +VGic::serialize(CheckpointOut &cp) const { Tick interrupt_time[VGIC_CPU_MAX]; for (uint32_t cpu = 0; cpu < VGIC_CPU_MAX; cpu++) { @@ -457,42 +454,45 @@ VGic::serialize(std::ostream &os) SERIALIZE_SCALAR(pioDelay); SERIALIZE_SCALAR(maintInt); - for (uint32_t cpu = 0; cpu < VGIC_CPU_MAX; cpu++) { - nameOut(os, csprintf("%s.vcpuData%d", name(), cpu)); - uint32_t vctrl_val = vcpuData[cpu].vctrl; - SERIALIZE_SCALAR(vctrl_val); - uint32_t hcr_val = vcpuData[cpu].hcr; - SERIALIZE_SCALAR(hcr_val); - uint64_t eisr_val = vcpuData[cpu].eisr; - SERIALIZE_SCALAR(eisr_val); - uint8_t VMGrp0En_val = vcpuData[cpu].VMGrp0En; - SERIALIZE_SCALAR(VMGrp0En_val); - uint8_t VMGrp1En_val = vcpuData[cpu].VMGrp1En; - SERIALIZE_SCALAR(VMGrp1En_val); - uint8_t VMAckCtl_val = vcpuData[cpu].VMAckCtl; - SERIALIZE_SCALAR(VMAckCtl_val); - uint8_t VMFiqEn_val = vcpuData[cpu].VMFiqEn; - SERIALIZE_SCALAR(VMFiqEn_val); - uint8_t VMCBPR_val = vcpuData[cpu].VMCBPR; - SERIALIZE_SCALAR(VMCBPR_val); - uint8_t VEM_val = vcpuData[cpu].VEM; - SERIALIZE_SCALAR(VEM_val); - uint8_t VMABP_val = vcpuData[cpu].VMABP; - SERIALIZE_SCALAR(VMABP_val); - uint8_t VMBP_val = vcpuData[cpu].VMBP; - SERIALIZE_SCALAR(VMBP_val); - uint8_t VMPriMask_val = vcpuData[cpu].VMPriMask; - SERIALIZE_SCALAR(VMPriMask_val); - - for (int i = 0; i < NUM_LR; i++) { - uint32_t lr = vcpuData[cpu].LR[i]; - nameOut(os, csprintf("%s.vcpuData%d.LR%d", name(), cpu, i)); - SERIALIZE_SCALAR(lr); - } + for (uint32_t cpu = 0; cpu < VGIC_CPU_MAX; cpu++) + vcpuData[cpu].serializeSection(cp, csprintf("vcpuData%d", cpu)); +} + +void +VGic::vcpuIntData::serialize(CheckpointOut &cp) const +{ + uint32_t vctrl_val = vctrl; + SERIALIZE_SCALAR(vctrl_val); + uint32_t hcr_val = hcr; + SERIALIZE_SCALAR(hcr_val); + uint64_t eisr_val = eisr; + SERIALIZE_SCALAR(eisr_val); + uint8_t VMGrp0En_val = VMGrp0En; + SERIALIZE_SCALAR(VMGrp0En_val); + uint8_t VMGrp1En_val = VMGrp1En; + SERIALIZE_SCALAR(VMGrp1En_val); + uint8_t VMAckCtl_val = VMAckCtl; + SERIALIZE_SCALAR(VMAckCtl_val); + uint8_t VMFiqEn_val = VMFiqEn; + SERIALIZE_SCALAR(VMFiqEn_val); + uint8_t VMCBPR_val = VMCBPR; + SERIALIZE_SCALAR(VMCBPR_val); + uint8_t VEM_val = VEM; + SERIALIZE_SCALAR(VEM_val); + uint8_t VMABP_val = VMABP; + SERIALIZE_SCALAR(VMABP_val); + uint8_t VMBP_val = VMBP; + SERIALIZE_SCALAR(VMBP_val); + uint8_t VMPriMask_val = VMPriMask; + SERIALIZE_SCALAR(VMPriMask_val); + + for (int i = 0; i < NUM_LR; i++) { + ScopedCheckpointSection sec_lr(cp, csprintf("LR%d", i)); + paramOut(cp, "lr", LR[i]); } } -void VGic::unserialize(Checkpoint *cp, const std::string §ion) +void VGic::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing Arm GIC\n"); @@ -502,37 +502,7 @@ void VGic::unserialize(Checkpoint *cp, const std::string §ion) if (interrupt_time[cpu]) schedule(postVIntEvent[cpu], interrupt_time[cpu]); - uint32_t tmp; - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "vctrl_val", tmp); - vcpuData[cpu].vctrl = tmp; - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "hcr_val", tmp); - vcpuData[cpu].hcr = tmp; - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "eisr_val", vcpuData[cpu].eisr); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMGrp0En_val", vcpuData[cpu].VMGrp0En); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMGrp1En_val", vcpuData[cpu].VMGrp1En); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMAckCtl_val", vcpuData[cpu].VMAckCtl); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMFiqEn_val", vcpuData[cpu].VMFiqEn); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMCBPR_val", vcpuData[cpu].VMCBPR); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VEM_val", vcpuData[cpu].VEM); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMABP_val", vcpuData[cpu].VMABP); - paramIn(cp, csprintf("%s.vcpuData%d", section, cpu), - "VMPriMask_val", vcpuData[cpu].VMPriMask); - - for (int i = 0; i < NUM_LR; i++) { - paramIn(cp, csprintf("%s.vcpuData%d.LR%d", section, cpu, i), - "lr", tmp); - vcpuData[cpu].LR[i] = tmp; - } + vcpuData[cpu].unserializeSection(cp, csprintf("vcpuData%d", cpu)); } UNSERIALIZE_ARRAY(maintIntPosted, VGIC_CPU_MAX); UNSERIALIZE_ARRAY(vIntPosted, VGIC_CPU_MAX); @@ -542,6 +512,27 @@ void VGic::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(maintInt); } +void +VGic::vcpuIntData::unserialize(CheckpointIn &cp) +{ + paramIn(cp, "vctrl_val", vctrl); + paramIn(cp, "hcr_val", hcr); + paramIn(cp, "eisr_val", eisr); + paramIn(cp, "VMGrp0En_val", VMGrp0En); + paramIn(cp, "VMGrp1En_val", VMGrp1En); + paramIn(cp, "VMAckCtl_val", VMAckCtl); + paramIn(cp, "VMFiqEn_val", VMFiqEn); + paramIn(cp, "VMCBPR_val", VMCBPR); + paramIn(cp, "VEM_val", VEM); + paramIn(cp, "VMABP_val", VMABP); + paramIn(cp, "VMPriMask_val", VMPriMask); + + for (int i = 0; i < NUM_LR; i++) { + ScopedCheckpointSection sec_lr(cp, csprintf("LR%d", i)); + paramIn(cp, "lr", LR[i]); + } +} + VGic * VGicParams::create() { diff --git a/src/dev/arm/vgic.hh b/src/dev/arm/vgic.hh index e1c4960e9..ac88f842f 100644 --- a/src/dev/arm/vgic.hh +++ b/src/dev/arm/vgic.hh @@ -52,6 +52,9 @@ #ifndef __DEV_ARM_VGIC_H__ #define __DEV_ARM_VGIC_H__ +#include <algorithm> +#include <array> + #include "base/addr_range.hh" #include "base/bitunion.hh" #include "cpu/intr_control.hh" @@ -162,8 +165,17 @@ class VGic : public PioDevice /* State per CPU. EVERYTHING should be in this struct and simply replicated * N times. */ - struct vcpuIntData { - ListReg LR[NUM_LR]; + struct vcpuIntData : public Serializable { + vcpuIntData() + : vctrl(0), hcr(0), eisr(0), VMGrp0En(0), VMGrp1En(0), + VMAckCtl(0), VMFiqEn(0), VMCBPR(0), VEM(0), VMABP(0), VMBP(0), + VMPriMask(0) + { + std::fill(LR.begin(), LR.end(), 0); + } + virtual ~vcpuIntData() {} + + std::array<ListReg, NUM_LR> LR; VCTLR vctrl; HCR hcr; @@ -179,9 +191,12 @@ class VGic : public PioDevice uint8_t VMABP; uint8_t VMBP; uint8_t VMPriMask; + + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; - struct vcpuIntData vcpuData[VGIC_CPU_MAX]; + struct std::array<vcpuIntData, VGIC_CPU_MAX> vcpuData; public: typedef VGicParams Params; @@ -197,8 +212,8 @@ class VGic : public PioDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; private: Tick readVCpu(PacketPtr pkt); diff --git a/src/dev/copy_engine.cc b/src/dev/copy_engine.cc index a3d73b634..5506103b1 100644 --- a/src/dev/copy_engine.cc +++ b/src/dev/copy_engine.cc @@ -676,27 +676,25 @@ CopyEngine::drain(DrainManager *dm) } void -CopyEngine::serialize(std::ostream &os) +CopyEngine::serialize(CheckpointOut &cp) const { - PciDevice::serialize(os); - regs.serialize(os); - for (int x =0; x < chan.size(); x++) { - nameOut(os, csprintf("%s.channel%d", name(), x)); - chan[x]->serialize(os); - } + PciDevice::serialize(cp); + regs.serialize(cp); + for (int x =0; x < chan.size(); x++) + chan[x]->serializeSection(cp, csprintf("channel%d", x)); } void -CopyEngine::unserialize(Checkpoint *cp, const std::string §ion) +CopyEngine::unserialize(CheckpointIn &cp) { - PciDevice::unserialize(cp, section); - regs.unserialize(cp, section); + PciDevice::unserialize(cp); + regs.unserialize(cp); for (int x = 0; x < chan.size(); x++) - chan[x]->unserialize(cp, csprintf("%s.channel%d", section, x)); + chan[x]->unserializeSection(cp, csprintf("channel%d", x)); } void -CopyEngine::CopyEngineChannel::serialize(std::ostream &os) +CopyEngine::CopyEngineChannel::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(channelId); SERIALIZE_SCALAR(busy); @@ -707,13 +705,13 @@ CopyEngine::CopyEngineChannel::serialize(std::ostream &os) SERIALIZE_SCALAR(fetchAddress); int nextState = this->nextState; SERIALIZE_SCALAR(nextState); - arrayParamOut(os, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc)); + arrayParamOut(cp, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc)); SERIALIZE_ARRAY(copyBuffer, ce->params()->XferCap); - cr.serialize(os); + cr.serialize(cp); } void -CopyEngine::CopyEngineChannel::unserialize(Checkpoint *cp, const std::string §ion) +CopyEngine::CopyEngineChannel::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(channelId); UNSERIALIZE_SCALAR(busy); @@ -725,9 +723,9 @@ CopyEngine::CopyEngineChannel::unserialize(Checkpoint *cp, const std::string &se int nextState; UNSERIALIZE_SCALAR(nextState); this->nextState = (ChannelState)nextState; - arrayParamIn(cp, section, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc)); + arrayParamIn(cp, "curDmaDesc", (uint8_t*)curDmaDesc, sizeof(DmaDesc)); UNSERIALIZE_ARRAY(copyBuffer, ce->params()->XferCap); - cr.unserialize(cp, section); + cr.unserialize(cp); } diff --git a/src/dev/copy_engine.hh b/src/dev/copy_engine.hh index 1186d0b1d..80c9798ee 100644 --- a/src/dev/copy_engine.hh +++ b/src/dev/copy_engine.hh @@ -60,7 +60,7 @@ class CopyEngine : public PciDevice { - class CopyEngineChannel : public Drainable + class CopyEngineChannel : public Drainable, public Serializable { private: DmaPort cePort; @@ -110,8 +110,8 @@ class CopyEngine : public PciDevice unsigned int drain(DrainManager *drainManger); void drainResume(); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; private: void fetchDescriptor(Addr address); @@ -205,8 +205,8 @@ class CopyEngine : public PciDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; unsigned int drain(DrainManager *drainManger); void drainResume(); diff --git a/src/dev/copy_engine_defs.hh b/src/dev/copy_engine_defs.hh index 98216e64c..afefac2b5 100644 --- a/src/dev/copy_engine_defs.hh +++ b/src/dev/copy_engine_defs.hh @@ -100,18 +100,18 @@ struct Reg { bool operator==(T d) { return d == _data; } void operator()(T d) { _data = d; } Reg() { _data = 0; } - void serialize(std::ostream &os) + void serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(_data); } - void unserialize(Checkpoint *cp, const std::string §ion) + void unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(_data); } }; -struct Regs { +struct Regs : public Serializable { uint8_t chanCount; uint8_t xferCap; @@ -125,25 +125,25 @@ struct Regs { uint32_t attnStatus; // Read clears - void serialize(std::ostream &os) + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE { SERIALIZE_SCALAR(chanCount); SERIALIZE_SCALAR(xferCap); - paramOut(os, "intrctrl", intrctrl._data); + paramOut(cp, "intrctrl", intrctrl._data); SERIALIZE_SCALAR(attnStatus); } - void unserialize(Checkpoint *cp, const std::string §ion) + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE { UNSERIALIZE_SCALAR(chanCount); UNSERIALIZE_SCALAR(xferCap); - paramIn(cp, section, "intrctrl", intrctrl._data); + paramIn(cp, "intrctrl", intrctrl._data); UNSERIALIZE_SCALAR(attnStatus); } }; -struct ChanRegs { +struct ChanRegs : public Serializable { struct CHANCTRL : public Reg<uint16_t> { // channelX + 0x00 using Reg<uint16_t>::operator =; ADD_FIELD16(interrupt_disable,0,1); @@ -197,24 +197,24 @@ struct ChanRegs { }; CHANERR error; - void serialize(std::ostream &os) + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE { - paramOut(os, "ctrl", ctrl._data); - paramOut(os, "status", status._data); + paramOut(cp, "ctrl", ctrl._data); + paramOut(cp, "status", status._data); SERIALIZE_SCALAR(descChainAddr); - paramOut(os, "command", command._data); + paramOut(cp, "command", command._data); SERIALIZE_SCALAR(completionAddr); - paramOut(os, "error", error._data); + paramOut(cp, "error", error._data); } - void unserialize(Checkpoint *cp, const std::string §ion) + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE { - paramIn(cp, section, "ctrl", ctrl._data); - paramIn(cp, section, "status", status._data); + paramIn(cp, "ctrl", ctrl._data); + paramIn(cp, "status", status._data); UNSERIALIZE_SCALAR(descChainAddr); - paramIn(cp, section, "command", command._data); + paramIn(cp, "command", command._data); UNSERIALIZE_SCALAR(completionAddr); - paramIn(cp, section, "error", error._data); + paramIn(cp, "error", error._data); } diff --git a/src/dev/disk_image.cc b/src/dev/disk_image.cc index 8194eb507..e4907853f 100644 --- a/src/dev/disk_image.cc +++ b/src/dev/disk_image.cc @@ -308,13 +308,13 @@ SafeWriteSwap(ofstream &stream, const T &data) SafeWrite(stream, &swappeddata, sizeof(data)); } void -CowDiskImage::save() +CowDiskImage::save() const { save(filename); } void -CowDiskImage::save(const string &file) +CowDiskImage::save(const string &file) const { if (!initialized) panic("RawDiskImage not initialized"); @@ -408,19 +408,19 @@ CowDiskImage::write(const uint8_t *data, std::streampos offset) } void -CowDiskImage::serialize(ostream &os) +CowDiskImage::serialize(CheckpointOut &cp) const { string cowFilename = name() + ".cow"; SERIALIZE_SCALAR(cowFilename); - save(Checkpoint::dir() + "/" + cowFilename); + save(CheckpointIn::dir() + "/" + cowFilename); } void -CowDiskImage::unserialize(Checkpoint *cp, const string §ion) +CowDiskImage::unserialize(CheckpointIn &cp) { string cowFilename; UNSERIALIZE_SCALAR(cowFilename); - cowFilename = cp->cptDir + "/" + cowFilename; + cowFilename = cp.cptDir + "/" + cowFilename; open(cowFilename); } diff --git a/src/dev/disk_image.hh b/src/dev/disk_image.hh index da96082cb..25483eed5 100644 --- a/src/dev/disk_image.hh +++ b/src/dev/disk_image.hh @@ -125,11 +125,12 @@ class CowDiskImage : public DiskImage void initSectorTable(int hash_size); bool open(const std::string &file); - void save(); - void save(const std::string &file); + void save() const; + void save(const std::string &file) const; void writeback(); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; virtual std::streampos size() const; diff --git a/src/dev/etherlink.cc b/src/dev/etherlink.cc index c5ef66d99..27179d508 100644 --- a/src/dev/etherlink.cc +++ b/src/dev/etherlink.cc @@ -107,17 +107,17 @@ EtherLink::Link::Link(const string &name, EtherLink *p, int num, { } void -EtherLink::serialize(ostream &os) +EtherLink::serialize(CheckpointOut &cp) const { - link[0]->serialize("link0", os); - link[1]->serialize("link1", os); + link[0]->serialize("link0", cp); + link[1]->serialize("link1", cp); } void -EtherLink::unserialize(Checkpoint *cp, const string §ion) +EtherLink::unserialize(CheckpointIn &cp) { - link[0]->unserialize("link0", cp, section); - link[1]->unserialize("link1", cp, section); + link[0]->unserialize("link0", cp); + link[1]->unserialize("link1", cp); } void @@ -141,11 +141,11 @@ class LinkDelayEvent : public Event void process(); - virtual void serialize(ostream &os); - void unserialize(Checkpoint *cp, const string §ion) {} - void unserialize(Checkpoint *cp, const string §ion, - EventQueue *eventq); - static Serializable *createForUnserialize(Checkpoint *cp, + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE {} + void unserializeEvent(CheckpointIn &cp, + EventQueue *eventq) M5_ATTR_OVERRIDE; + static Serializable *createForUnserialize(CheckpointIn &cp, const string §ion); }; @@ -193,38 +193,37 @@ EtherLink::Link::transmit(EthPacketPtr pkt) } void -EtherLink::Link::serialize(const string &base, ostream &os) +EtherLink::Link::serialize(const string &base, CheckpointOut &cp) const { bool packet_exists = packet != nullptr; - paramOut(os, base + ".packet_exists", packet_exists); + paramOut(cp, base + ".packet_exists", packet_exists); if (packet_exists) - packet->serialize(base + ".packet", os); + packet->serialize(base + ".packet", cp); bool event_scheduled = doneEvent.scheduled(); - paramOut(os, base + ".event_scheduled", event_scheduled); + paramOut(cp, base + ".event_scheduled", event_scheduled); if (event_scheduled) { Tick event_time = doneEvent.when(); - paramOut(os, base + ".event_time", event_time); + paramOut(cp, base + ".event_time", event_time); } } void -EtherLink::Link::unserialize(const string &base, Checkpoint *cp, - const string §ion) +EtherLink::Link::unserialize(const string &base, CheckpointIn &cp) { bool packet_exists; - paramIn(cp, section, base + ".packet_exists", packet_exists); + paramIn(cp, base + ".packet_exists", packet_exists); if (packet_exists) { packet = make_shared<EthPacketData>(16384); - packet->unserialize(base + ".packet", cp, section); + packet->unserialize(base + ".packet", cp); } bool event_scheduled; - paramIn(cp, section, base + ".event_scheduled", event_scheduled); + paramIn(cp, base + ".event_scheduled", event_scheduled); if (event_scheduled) { Tick event_time; - paramIn(cp, section, base + ".event_time", event_time); + paramIn(cp, base + ".event_time", event_time); parent->schedule(doneEvent, event_time); } } @@ -246,25 +245,24 @@ LinkDelayEvent::process() } void -LinkDelayEvent::serialize(ostream &os) +LinkDelayEvent::serialize(CheckpointOut &cp) const { - paramOut(os, "type", string("LinkDelayEvent")); - Event::serialize(os); + paramOut(cp, "type", string("LinkDelayEvent")); + Event::serialize(cp); EtherLink *parent = link->parent; bool number = link->number; SERIALIZE_OBJPTR(parent); SERIALIZE_SCALAR(number); - packet->serialize("packet", os); + packet->serialize("packet", cp); } void -LinkDelayEvent::unserialize(Checkpoint *cp, const string §ion, - EventQueue *eventq) +LinkDelayEvent::unserializeEvent(CheckpointIn &cp, EventQueue *eventq) { - Event::unserialize(cp, section, eventq); + Event::unserializeEvent(cp, eventq); EtherLink *parent; bool number; @@ -274,12 +272,12 @@ LinkDelayEvent::unserialize(Checkpoint *cp, const string §ion, link = parent->link[number]; packet = make_shared<EthPacketData>(16384); - packet->unserialize("packet", cp, section); + packet->unserialize("packet", cp); } Serializable * -LinkDelayEvent::createForUnserialize(Checkpoint *cp, const string §ion) +LinkDelayEvent::createForUnserialize(CheckpointIn &cp, const string §ion) { return new LinkDelayEvent(); } diff --git a/src/dev/etherlink.hh b/src/dev/etherlink.hh index ca17b837d..525e8250d 100644 --- a/src/dev/etherlink.hh +++ b/src/dev/etherlink.hh @@ -99,9 +99,8 @@ class EtherLink : public EtherObject void setTxInt(Interface *i) { assert(!txint); txint = i; } void setRxInt(Interface *i) { assert(!rxint); rxint = i; } - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void serialize(const std::string &base, CheckpointOut &cp) const; + void unserialize(const std::string &base, CheckpointIn &cp); }; /* @@ -135,8 +134,8 @@ class EtherLink : public EtherObject virtual EtherInt *getEthPort(const std::string &if_name, int idx); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; diff --git a/src/dev/etherpkt.cc b/src/dev/etherpkt.cc index 2c8343eb0..548a1f179 100644 --- a/src/dev/etherpkt.cc +++ b/src/dev/etherpkt.cc @@ -37,17 +37,16 @@ using namespace std; void -EthPacketData::serialize(const string &base, ostream &os) +EthPacketData::serialize(const string &base, CheckpointOut &cp) const { - paramOut(os, base + ".length", length); - arrayParamOut(os, base + ".data", data, length); + paramOut(cp, base + ".length", length); + arrayParamOut(cp, base + ".data", data, length); } void -EthPacketData::unserialize(const string &base, Checkpoint *cp, - const string §ion) +EthPacketData::unserialize(const string &base, CheckpointIn &cp) { - paramIn(cp, section, base + ".length", length); + paramIn(cp, base + ".length", length); if (length) - arrayParamIn(cp, section, base + ".data", data, length); + arrayParamIn(cp, base + ".data", data, length); } diff --git a/src/dev/etherpkt.hh b/src/dev/etherpkt.hh index febd303a1..acda9fb47 100644 --- a/src/dev/etherpkt.hh +++ b/src/dev/etherpkt.hh @@ -41,11 +41,11 @@ #include <memory> #include "base/types.hh" +#include "sim/serialize.hh" /* * Reference counted class containing ethernet packet data */ -class Checkpoint; class EthPacketData { public: @@ -71,9 +71,8 @@ class EthPacketData ~EthPacketData() { if (data) delete [] data; } public: - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void serialize(const std::string &base, CheckpointOut &cp) const; + void unserialize(const std::string &base, CheckpointIn &cp); }; typedef std::shared_ptr<EthPacketData> EthPacketPtr; diff --git a/src/dev/ethertap.cc b/src/dev/ethertap.cc index 38ce4a2b3..d062b5d8a 100644 --- a/src/dev/ethertap.cc +++ b/src/dev/ethertap.cc @@ -294,7 +294,7 @@ EtherTap::getEthPort(const std::string &if_name, int idx) //===================================================================== void -EtherTap::serialize(ostream &os) +EtherTap::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(socket); SERIALIZE_SCALAR(buflen); @@ -307,7 +307,7 @@ EtherTap::serialize(ostream &os) if (event) { tapevent_present = true; SERIALIZE_SCALAR(tapevent_present); - event->serialize(os); + event->serialize(cp); } else { SERIALIZE_SCALAR(tapevent_present); @@ -315,7 +315,7 @@ EtherTap::serialize(ostream &os) } void -EtherTap::unserialize(Checkpoint *cp, const std::string §ion) +EtherTap::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(socket); UNSERIALIZE_SCALAR(buflen); @@ -329,7 +329,7 @@ EtherTap::unserialize(Checkpoint *cp, const std::string §ion) if (tapevent_present) { event = new TapEvent(this, socket, POLLIN|POLLERR); - event->unserialize(cp,section); + event->unserialize(cp); if (event->queued()) { pollQueue.schedule(event); diff --git a/src/dev/ethertap.hh b/src/dev/ethertap.hh index 2f38d57b4..9c21dfc03 100644 --- a/src/dev/ethertap.hh +++ b/src/dev/ethertap.hh @@ -115,8 +115,8 @@ class EtherTap : public EtherObject virtual bool recvPacket(EthPacketPtr packet); virtual void sendDone(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; class EtherTapInt : public EtherInt diff --git a/src/dev/i2cbus.cc b/src/dev/i2cbus.cc index 9d7da44d0..03ca6769c 100644 --- a/src/dev/i2cbus.cc +++ b/src/dev/i2cbus.cc @@ -212,7 +212,7 @@ I2CBus::isEnd(PacketPtr pkt) const return scl && (msg & 2) && daddr == SB_CONTROLS; } void -I2CBus::serialize(std::ostream &os) +I2CBus::serialize(CheckpointOut &cp) const { DPRINTF(Checkpoint, "Serializing I2C bus.\n"); SERIALIZE_SCALAR(scl); @@ -224,7 +224,7 @@ I2CBus::serialize(std::ostream &os) } void -I2CBus::unserialize(Checkpoint *cp, const std::string §ion) +I2CBus::unserialize(CheckpointIn &cp) { DPRINTF(Checkpoint, "Unserializing I2C bus.\n"); UNSERIALIZE_SCALAR(scl); diff --git a/src/dev/i2cbus.hh b/src/dev/i2cbus.hh index 318950b39..3ebfa308b 100644 --- a/src/dev/i2cbus.hh +++ b/src/dev/i2cbus.hh @@ -146,8 +146,8 @@ class I2CBus : public BasicPioDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream& os); - virtual void unserialize(Checkpoint* cp, const std::string& section); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif //__DEV_I2CBUS diff --git a/src/dev/i8254xGBe.cc b/src/dev/i8254xGBe.cc index 213ad580a..0ff52bda0 100644 --- a/src/dev/i8254xGBe.cc +++ b/src/dev/i8254xGBe.cc @@ -1117,7 +1117,7 @@ IGbE::DescCache<T>::reset() template<class T> void -IGbE::DescCache<T>::serialize(std::ostream &os) +IGbE::DescCache<T>::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(cachePnt); SERIALIZE_SCALAR(curFetching); @@ -1128,14 +1128,14 @@ IGbE::DescCache<T>::serialize(std::ostream &os) typename CacheType::size_type usedCacheSize = usedCache.size(); SERIALIZE_SCALAR(usedCacheSize); for (typename CacheType::size_type x = 0; x < usedCacheSize; x++) { - arrayParamOut(os, csprintf("usedCache_%d", x), + arrayParamOut(cp, csprintf("usedCache_%d", x), (uint8_t*)usedCache[x],sizeof(T)); } typename CacheType::size_type unusedCacheSize = unusedCache.size(); SERIALIZE_SCALAR(unusedCacheSize); for (typename CacheType::size_type x = 0; x < unusedCacheSize; x++) { - arrayParamOut(os, csprintf("unusedCache_%d", x), + arrayParamOut(cp, csprintf("unusedCache_%d", x), (uint8_t*)unusedCache[x],sizeof(T)); } @@ -1152,7 +1152,7 @@ IGbE::DescCache<T>::serialize(std::ostream &os) template<class T> void -IGbE::DescCache<T>::unserialize(Checkpoint *cp, const std::string §ion) +IGbE::DescCache<T>::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(cachePnt); UNSERIALIZE_SCALAR(curFetching); @@ -1165,7 +1165,7 @@ IGbE::DescCache<T>::unserialize(Checkpoint *cp, const std::string §ion) T *temp; for (typename CacheType::size_type x = 0; x < usedCacheSize; x++) { temp = new T; - arrayParamIn(cp, section, csprintf("usedCache_%d", x), + arrayParamIn(cp, csprintf("usedCache_%d", x), (uint8_t*)temp,sizeof(T)); usedCache.push_back(temp); } @@ -1174,7 +1174,7 @@ IGbE::DescCache<T>::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(unusedCacheSize); for (typename CacheType::size_type x = 0; x < unusedCacheSize; x++) { temp = new T; - arrayParamIn(cp, section, csprintf("unusedCache_%d", x), + arrayParamIn(cp, csprintf("unusedCache_%d", x), (uint8_t*)temp,sizeof(T)); unusedCache.push_back(temp); } @@ -1518,18 +1518,18 @@ IGbE::RxDescCache::hasOutstandingEvents() } void -IGbE::RxDescCache::serialize(std::ostream &os) +IGbE::RxDescCache::serialize(CheckpointOut &cp) const { - DescCache<RxDesc>::serialize(os); + DescCache<RxDesc>::serialize(cp); SERIALIZE_SCALAR(pktDone); SERIALIZE_SCALAR(splitCount); SERIALIZE_SCALAR(bytesCopied); } void -IGbE::RxDescCache::unserialize(Checkpoint *cp, const std::string §ion) +IGbE::RxDescCache::unserialize(CheckpointIn &cp) { - DescCache<RxDesc>::unserialize(cp, section); + DescCache<RxDesc>::unserialize(cp); UNSERIALIZE_SCALAR(pktDone); UNSERIALIZE_SCALAR(splitCount); UNSERIALIZE_SCALAR(bytesCopied); @@ -1961,9 +1961,10 @@ IGbE::TxDescCache::actionAfterWb() } void -IGbE::TxDescCache::serialize(std::ostream &os) +IGbE::TxDescCache::serialize(CheckpointOut &cp) const { - DescCache<TxDesc>::serialize(os); + DescCache<TxDesc>::serialize(cp); + SERIALIZE_SCALAR(pktDone); SERIALIZE_SCALAR(isTcp); SERIALIZE_SCALAR(pktWaiting); @@ -1989,9 +1990,10 @@ IGbE::TxDescCache::serialize(std::ostream &os) } void -IGbE::TxDescCache::unserialize(Checkpoint *cp, const std::string §ion) +IGbE::TxDescCache::unserialize(CheckpointIn &cp) { - DescCache<TxDesc>::unserialize(cp, section); + DescCache<TxDesc>::unserialize(cp); + UNSERIALIZE_SCALAR(pktDone); UNSERIALIZE_SCALAR(isTcp); UNSERIALIZE_SCALAR(pktWaiting); @@ -2452,11 +2454,11 @@ IGbE::ethTxDone() } void -IGbE::serialize(std::ostream &os) +IGbE::serialize(CheckpointOut &cp) const { - PciDevice::serialize(os); + PciDevice::serialize(cp); - regs.serialize(os); + regs.serialize(cp); SERIALIZE_SCALAR(eeOpBits); SERIALIZE_SCALAR(eeAddrBits); SERIALIZE_SCALAR(eeDataBits); @@ -2465,13 +2467,13 @@ IGbE::serialize(std::ostream &os) SERIALIZE_SCALAR(lastInterrupt); SERIALIZE_ARRAY(flash,iGbReg::EEPROM_SIZE); - rxFifo.serialize("rxfifo", os); - txFifo.serialize("txfifo", os); + rxFifo.serialize("rxfifo", cp); + txFifo.serialize("txfifo", cp); bool txPktExists = txPacket != nullptr; SERIALIZE_SCALAR(txPktExists); if (txPktExists) - txPacket->serialize("txpacket", os); + txPacket->serialize("txpacket", cp); Tick rdtr_time = 0, radv_time = 0, tidv_time = 0, tadv_time = 0, inter_time = 0; @@ -2498,19 +2500,16 @@ IGbE::serialize(std::ostream &os) SERIALIZE_SCALAR(pktOffset); - nameOut(os, csprintf("%s.TxDescCache", name())); - txDescCache.serialize(os); - - nameOut(os, csprintf("%s.RxDescCache", name())); - rxDescCache.serialize(os); + txDescCache.serializeSection(cp, "TxDescCache"); + rxDescCache.serializeSection(cp, "RxDescCache"); } void -IGbE::unserialize(Checkpoint *cp, const std::string §ion) +IGbE::unserialize(CheckpointIn &cp) { - PciDevice::unserialize(cp, section); + PciDevice::unserialize(cp); - regs.unserialize(cp, section); + regs.unserialize(cp); UNSERIALIZE_SCALAR(eeOpBits); UNSERIALIZE_SCALAR(eeAddrBits); UNSERIALIZE_SCALAR(eeDataBits); @@ -2519,14 +2518,14 @@ IGbE::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(lastInterrupt); UNSERIALIZE_ARRAY(flash,iGbReg::EEPROM_SIZE); - rxFifo.unserialize("rxfifo", cp, section); - txFifo.unserialize("txfifo", cp, section); + rxFifo.unserialize("rxfifo", cp); + txFifo.unserialize("txfifo", cp); bool txPktExists; UNSERIALIZE_SCALAR(txPktExists); if (txPktExists) { txPacket = std::make_shared<EthPacketData>(16384); - txPacket->unserialize("txpacket", cp, section); + txPacket->unserialize("txpacket", cp); } rxTick = true; @@ -2557,9 +2556,8 @@ IGbE::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(pktOffset); - txDescCache.unserialize(cp, csprintf("%s.TxDescCache", section)); - - rxDescCache.unserialize(cp, csprintf("%s.RxDescCache", section)); + txDescCache.unserializeSection(cp, "TxDescCache"); + rxDescCache.unserializeSection(cp, "RxDescCache"); } IGbE * diff --git a/src/dev/i8254xGBe.hh b/src/dev/i8254xGBe.hh index 27439740d..d353c1d83 100644 --- a/src/dev/i8254xGBe.hh +++ b/src/dev/i8254xGBe.hh @@ -218,7 +218,7 @@ class IGbE : public EtherDevice template<class T> - class DescCache + class DescCache : public Serializable { protected: virtual Addr descBase() const = 0; @@ -331,8 +331,9 @@ class IGbE : public EtherDevice * changed */ void reset(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; virtual bool hasOutstandingEvents() { return wbEvent.scheduled() || fetchEvent.scheduled(); @@ -395,8 +396,8 @@ class IGbE : public EtherDevice virtual bool hasOutstandingEvents(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; friend class RxDescCache; @@ -506,10 +507,10 @@ class IGbE : public EtherDevice } EventWrapper<TxDescCache, &TxDescCache::nullCallback> nullEvent; - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; + friend class TxDescCache; TxDescCache txDescCache; @@ -537,8 +538,8 @@ class IGbE : public EtherDevice bool ethRxPkt(EthPacketPtr packet); void ethTxDone(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; unsigned int drain(DrainManager *dm); void drainResume(); diff --git a/src/dev/i8254xGBe_defs.hh b/src/dev/i8254xGBe_defs.hh index 3b45f6498..92257aea7 100644 --- a/src/dev/i8254xGBe_defs.hh +++ b/src/dev/i8254xGBe_defs.hh @@ -294,7 +294,7 @@ inline int utcmd(TxDesc *d) { assert(isContext(d)); return bits(d->d2,24,31); } inline uint64_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \ inline void NAME(uint64_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); } -struct Regs { +struct Regs : public Serializable { template<class T> struct Reg { T _data; @@ -303,11 +303,11 @@ struct Regs { bool operator==(T d) { return d == _data; } void operator()(T d) { _data = d; } Reg() { _data = 0; } - void serialize(std::ostream &os) + void serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(_data); } - void unserialize(Checkpoint *cp, const std::string §ion) + void unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(_data); } @@ -759,95 +759,95 @@ struct Regs { uint32_t sw_fw_sync; - void serialize(std::ostream &os) + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE { - paramOut(os, "ctrl", ctrl._data); - paramOut(os, "sts", sts._data); - paramOut(os, "eecd", eecd._data); - paramOut(os, "eerd", eerd._data); - paramOut(os, "ctrl_ext", ctrl_ext._data); - paramOut(os, "mdic", mdic._data); - paramOut(os, "icr", icr._data); + paramOut(cp, "ctrl", ctrl._data); + paramOut(cp, "sts", sts._data); + paramOut(cp, "eecd", eecd._data); + paramOut(cp, "eerd", eerd._data); + paramOut(cp, "ctrl_ext", ctrl_ext._data); + paramOut(cp, "mdic", mdic._data); + paramOut(cp, "icr", icr._data); SERIALIZE_SCALAR(imr); - paramOut(os, "itr", itr._data); + paramOut(cp, "itr", itr._data); SERIALIZE_SCALAR(iam); - paramOut(os, "rctl", rctl._data); - paramOut(os, "fcttv", fcttv._data); - paramOut(os, "tctl", tctl._data); - paramOut(os, "pba", pba._data); - paramOut(os, "fcrtl", fcrtl._data); - paramOut(os, "fcrth", fcrth._data); - paramOut(os, "rdba", rdba._data); - paramOut(os, "rdlen", rdlen._data); - paramOut(os, "srrctl", srrctl._data); - paramOut(os, "rdh", rdh._data); - paramOut(os, "rdt", rdt._data); - paramOut(os, "rdtr", rdtr._data); - paramOut(os, "rxdctl", rxdctl._data); - paramOut(os, "radv", radv._data); - paramOut(os, "rsrpd", rsrpd._data); - paramOut(os, "tdba", tdba._data); - paramOut(os, "tdlen", tdlen._data); - paramOut(os, "tdh", tdh._data); - paramOut(os, "txdca_ctl", txdca_ctl._data); - paramOut(os, "tdt", tdt._data); - paramOut(os, "tidv", tidv._data); - paramOut(os, "txdctl", txdctl._data); - paramOut(os, "tadv", tadv._data); - //paramOut(os, "tdwba", tdwba._data); + paramOut(cp, "rctl", rctl._data); + paramOut(cp, "fcttv", fcttv._data); + paramOut(cp, "tctl", tctl._data); + paramOut(cp, "pba", pba._data); + paramOut(cp, "fcrtl", fcrtl._data); + paramOut(cp, "fcrth", fcrth._data); + paramOut(cp, "rdba", rdba._data); + paramOut(cp, "rdlen", rdlen._data); + paramOut(cp, "srrctl", srrctl._data); + paramOut(cp, "rdh", rdh._data); + paramOut(cp, "rdt", rdt._data); + paramOut(cp, "rdtr", rdtr._data); + paramOut(cp, "rxdctl", rxdctl._data); + paramOut(cp, "radv", radv._data); + paramOut(cp, "rsrpd", rsrpd._data); + paramOut(cp, "tdba", tdba._data); + paramOut(cp, "tdlen", tdlen._data); + paramOut(cp, "tdh", tdh._data); + paramOut(cp, "txdca_ctl", txdca_ctl._data); + paramOut(cp, "tdt", tdt._data); + paramOut(cp, "tidv", tidv._data); + paramOut(cp, "txdctl", txdctl._data); + paramOut(cp, "tadv", tadv._data); + //paramOut(cp, "tdwba", tdwba._data); SERIALIZE_SCALAR(tdwba); - paramOut(os, "rxcsum", rxcsum._data); + paramOut(cp, "rxcsum", rxcsum._data); SERIALIZE_SCALAR(rlpml); - paramOut(os, "rfctl", rfctl._data); - paramOut(os, "manc", manc._data); - paramOut(os, "swsm", swsm._data); - paramOut(os, "fwsm", fwsm._data); + paramOut(cp, "rfctl", rfctl._data); + paramOut(cp, "manc", manc._data); + paramOut(cp, "swsm", swsm._data); + paramOut(cp, "fwsm", fwsm._data); SERIALIZE_SCALAR(sw_fw_sync); } - void unserialize(Checkpoint *cp, const std::string §ion) + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE { - paramIn(cp, section, "ctrl", ctrl._data); - paramIn(cp, section, "sts", sts._data); - paramIn(cp, section, "eecd", eecd._data); - paramIn(cp, section, "eerd", eerd._data); - paramIn(cp, section, "ctrl_ext", ctrl_ext._data); - paramIn(cp, section, "mdic", mdic._data); - paramIn(cp, section, "icr", icr._data); + paramIn(cp, "ctrl", ctrl._data); + paramIn(cp, "sts", sts._data); + paramIn(cp, "eecd", eecd._data); + paramIn(cp, "eerd", eerd._data); + paramIn(cp, "ctrl_ext", ctrl_ext._data); + paramIn(cp, "mdic", mdic._data); + paramIn(cp, "icr", icr._data); UNSERIALIZE_SCALAR(imr); - paramIn(cp, section, "itr", itr._data); + paramIn(cp, "itr", itr._data); UNSERIALIZE_SCALAR(iam); - paramIn(cp, section, "rctl", rctl._data); - paramIn(cp, section, "fcttv", fcttv._data); - paramIn(cp, section, "tctl", tctl._data); - paramIn(cp, section, "pba", pba._data); - paramIn(cp, section, "fcrtl", fcrtl._data); - paramIn(cp, section, "fcrth", fcrth._data); - paramIn(cp, section, "rdba", rdba._data); - paramIn(cp, section, "rdlen", rdlen._data); - paramIn(cp, section, "srrctl", srrctl._data); - paramIn(cp, section, "rdh", rdh._data); - paramIn(cp, section, "rdt", rdt._data); - paramIn(cp, section, "rdtr", rdtr._data); - paramIn(cp, section, "rxdctl", rxdctl._data); - paramIn(cp, section, "radv", radv._data); - paramIn(cp, section, "rsrpd", rsrpd._data); - paramIn(cp, section, "tdba", tdba._data); - paramIn(cp, section, "tdlen", tdlen._data); - paramIn(cp, section, "tdh", tdh._data); - paramIn(cp, section, "txdca_ctl", txdca_ctl._data); - paramIn(cp, section, "tdt", tdt._data); - paramIn(cp, section, "tidv", tidv._data); - paramIn(cp, section, "txdctl", txdctl._data); - paramIn(cp, section, "tadv", tadv._data); + paramIn(cp, "rctl", rctl._data); + paramIn(cp, "fcttv", fcttv._data); + paramIn(cp, "tctl", tctl._data); + paramIn(cp, "pba", pba._data); + paramIn(cp, "fcrtl", fcrtl._data); + paramIn(cp, "fcrth", fcrth._data); + paramIn(cp, "rdba", rdba._data); + paramIn(cp, "rdlen", rdlen._data); + paramIn(cp, "srrctl", srrctl._data); + paramIn(cp, "rdh", rdh._data); + paramIn(cp, "rdt", rdt._data); + paramIn(cp, "rdtr", rdtr._data); + paramIn(cp, "rxdctl", rxdctl._data); + paramIn(cp, "radv", radv._data); + paramIn(cp, "rsrpd", rsrpd._data); + paramIn(cp, "tdba", tdba._data); + paramIn(cp, "tdlen", tdlen._data); + paramIn(cp, "tdh", tdh._data); + paramIn(cp, "txdca_ctl", txdca_ctl._data); + paramIn(cp, "tdt", tdt._data); + paramIn(cp, "tidv", tidv._data); + paramIn(cp, "txdctl", txdctl._data); + paramIn(cp, "tadv", tadv._data); UNSERIALIZE_SCALAR(tdwba); - //paramIn(cp, section, "tdwba", tdwba._data); - paramIn(cp, section, "rxcsum", rxcsum._data); + //paramIn(cp, "tdwba", tdwba._data); + paramIn(cp, "rxcsum", rxcsum._data); UNSERIALIZE_SCALAR(rlpml); - paramIn(cp, section, "rfctl", rfctl._data); - paramIn(cp, section, "manc", manc._data); - paramIn(cp, section, "swsm", swsm._data); - paramIn(cp, section, "fwsm", fwsm._data); + paramIn(cp, "rfctl", rfctl._data); + paramIn(cp, "manc", manc._data); + paramIn(cp, "swsm", swsm._data); + paramIn(cp, "fwsm", fwsm._data); UNSERIALIZE_SCALAR(sw_fw_sync); } }; diff --git a/src/dev/ide_ctrl.cc b/src/dev/ide_ctrl.cc index d931fab2b..3e6086265 100644 --- a/src/dev/ide_ctrl.cc +++ b/src/dev/ide_ctrl.cc @@ -555,14 +555,14 @@ IdeController::write(PacketPtr pkt) } void -IdeController::serialize(std::ostream &os) +IdeController::serialize(CheckpointOut &cp) const { // Serialize the PciDevice base class - PciDevice::serialize(os); + PciDevice::serialize(cp); // Serialize channels - primary.serialize("primary", os); - secondary.serialize("secondary", os); + primary.serialize("primary", cp); + secondary.serialize("secondary", cp); // Serialize config registers SERIALIZE_SCALAR(primaryTiming); @@ -580,31 +580,32 @@ IdeController::serialize(std::ostream &os) } void -IdeController::Channel::serialize(const std::string &base, std::ostream &os) +IdeController::Channel::serialize(const std::string &base, + CheckpointOut &cp) const { - paramOut(os, base + ".cmdAddr", cmdAddr); - paramOut(os, base + ".cmdSize", cmdSize); - paramOut(os, base + ".ctrlAddr", ctrlAddr); - paramOut(os, base + ".ctrlSize", ctrlSize); + paramOut(cp, base + ".cmdAddr", cmdAddr); + paramOut(cp, base + ".cmdSize", cmdSize); + paramOut(cp, base + ".ctrlAddr", ctrlAddr); + paramOut(cp, base + ".ctrlSize", ctrlSize); uint8_t command = bmiRegs.command; - paramOut(os, base + ".bmiRegs.command", command); - paramOut(os, base + ".bmiRegs.reserved0", bmiRegs.reserved0); + paramOut(cp, base + ".bmiRegs.command", command); + paramOut(cp, base + ".bmiRegs.reserved0", bmiRegs.reserved0); uint8_t status = bmiRegs.status; - paramOut(os, base + ".bmiRegs.status", status); - paramOut(os, base + ".bmiRegs.reserved1", bmiRegs.reserved1); - paramOut(os, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp); - paramOut(os, base + ".selectBit", selectBit); + paramOut(cp, base + ".bmiRegs.status", status); + paramOut(cp, base + ".bmiRegs.reserved1", bmiRegs.reserved1); + paramOut(cp, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp); + paramOut(cp, base + ".selectBit", selectBit); } void -IdeController::unserialize(Checkpoint *cp, const std::string §ion) +IdeController::unserialize(CheckpointIn &cp) { // Unserialize the PciDevice base class - PciDevice::unserialize(cp, section); + PciDevice::unserialize(cp); // Unserialize channels - primary.unserialize("primary", cp, section); - secondary.unserialize("secondary", cp, section); + primary.unserialize("primary", cp); + secondary.unserialize("secondary", cp); // Unserialize config registers UNSERIALIZE_SCALAR(primaryTiming); @@ -622,23 +623,22 @@ IdeController::unserialize(Checkpoint *cp, const std::string §ion) } void -IdeController::Channel::unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion) +IdeController::Channel::unserialize(const std::string &base, CheckpointIn &cp) { - paramIn(cp, section, base + ".cmdAddr", cmdAddr); - paramIn(cp, section, base + ".cmdSize", cmdSize); - paramIn(cp, section, base + ".ctrlAddr", ctrlAddr); - paramIn(cp, section, base + ".ctrlSize", ctrlSize); + paramIn(cp, base + ".cmdAddr", cmdAddr); + paramIn(cp, base + ".cmdSize", cmdSize); + paramIn(cp, base + ".ctrlAddr", ctrlAddr); + paramIn(cp, base + ".ctrlSize", ctrlSize); uint8_t command; - paramIn(cp, section, base +".bmiRegs.command", command); + paramIn(cp, base +".bmiRegs.command", command); bmiRegs.command = command; - paramIn(cp, section, base + ".bmiRegs.reserved0", bmiRegs.reserved0); + paramIn(cp, base + ".bmiRegs.reserved0", bmiRegs.reserved0); uint8_t status; - paramIn(cp, section, base + ".bmiRegs.status", status); + paramIn(cp, base + ".bmiRegs.status", status); bmiRegs.status = status; - paramIn(cp, section, base + ".bmiRegs.reserved1", bmiRegs.reserved1); - paramIn(cp, section, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp); - paramIn(cp, section, base + ".selectBit", selectBit); + paramIn(cp, base + ".bmiRegs.reserved1", bmiRegs.reserved1); + paramIn(cp, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp); + paramIn(cp, base + ".selectBit", selectBit); select(selectBit); } diff --git a/src/dev/ide_ctrl.hh b/src/dev/ide_ctrl.hh index 414e31087..7917432e4 100644 --- a/src/dev/ide_ctrl.hh +++ b/src/dev/ide_ctrl.hh @@ -111,9 +111,8 @@ class IdeController : public PciDevice Channel(std::string newName, Addr _cmdSize, Addr _ctrlSize); ~Channel(); - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void serialize(const std::string &base, std::ostream &os) const; + void unserialize(const std::string &base, CheckpointIn &cp); }; Channel primary; @@ -155,7 +154,7 @@ class IdeController : public PciDevice Tick read(PacketPtr pkt); Tick write(PacketPtr pkt); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __IDE_CTRL_HH_ diff --git a/src/dev/ide_disk.cc b/src/dev/ide_disk.cc index 4bf1a13c8..bbdee8e51 100644 --- a/src/dev/ide_disk.cc +++ b/src/dev/ide_disk.cc @@ -1063,7 +1063,7 @@ IdeDisk::updateState(DevAction_t action) } void -IdeDisk::serialize(ostream &os) +IdeDisk::serialize(CheckpointOut &cp) const { // Check all outstanding events to see if they are scheduled // these are all mutually exclusive @@ -1141,7 +1141,7 @@ IdeDisk::serialize(ostream &os) } void -IdeDisk::unserialize(Checkpoint *cp, const string §ion) +IdeDisk::unserialize(CheckpointIn &cp) { // Reschedule events that were outstanding // these are all mutually exclusive diff --git a/src/dev/ide_disk.hh b/src/dev/ide_disk.hh index 6ccca985e..79e931a29 100644 --- a/src/dev/ide_disk.hh +++ b/src/dev/ide_disk.hh @@ -365,18 +365,8 @@ class IdeDisk : public SimObject inline Addr pciToDma(Addr pciAddr); - /** - * Serialize this object to the given output stream. - * @param os The stream to serialize to. - */ - void serialize(std::ostream &os); - - /** - * Reconstruct the state of this object from a checkpoint. - * @param cp The checkpoint to use. - * @param section The section name describing this object. - */ - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc index 63bb6e8af..75600fb72 100644 --- a/src/dev/intel_8254_timer.cc +++ b/src/dev/intel_8254_timer.cc @@ -71,22 +71,21 @@ Intel8254Timer::writeControl(const CtrlReg data) } void -Intel8254Timer::serialize(const string &base, ostream &os) +Intel8254Timer::serialize(const string &base, CheckpointOut &cp) const { // serialize the counters - counter[0]->serialize(base + ".counter0", os); - counter[1]->serialize(base + ".counter1", os); - counter[2]->serialize(base + ".counter2", os); + counter[0]->serialize(base + ".counter0", cp); + counter[1]->serialize(base + ".counter1", cp); + counter[2]->serialize(base + ".counter2", cp); } void -Intel8254Timer::unserialize(const string &base, Checkpoint *cp, - const string §ion) +Intel8254Timer::unserialize(const string &base, CheckpointIn &cp) { // unserialze the counters - counter[0]->unserialize(base + ".counter0", cp, section); - counter[1]->unserialize(base + ".counter1", cp, section); - counter[2]->unserialize(base + ".counter2", cp, section); + counter[0]->unserialize(base + ".counter0", cp); + counter[1]->unserialize(base + ".counter1", cp); + counter[2]->unserialize(base + ".counter2", cp); } void @@ -229,39 +228,38 @@ Intel8254Timer::Counter::outputHigh() } void -Intel8254Timer::Counter::serialize(const string &base, ostream &os) +Intel8254Timer::Counter::serialize(const string &base, CheckpointOut &cp) const { - paramOut(os, base + ".initial_count", initial_count); - paramOut(os, base + ".latched_count", latched_count); - paramOut(os, base + ".period", period); - paramOut(os, base + ".mode", mode); - paramOut(os, base + ".output_high", output_high); - paramOut(os, base + ".latch_on", latch_on); - paramOut(os, base + ".read_byte", read_byte); - paramOut(os, base + ".write_byte", write_byte); + paramOut(cp, base + ".initial_count", initial_count); + paramOut(cp, base + ".latched_count", latched_count); + paramOut(cp, base + ".period", period); + paramOut(cp, base + ".mode", mode); + paramOut(cp, base + ".output_high", output_high); + paramOut(cp, base + ".latch_on", latch_on); + paramOut(cp, base + ".read_byte", read_byte); + paramOut(cp, base + ".write_byte", write_byte); Tick event_tick_offset = 0; if (event.scheduled()) event_tick_offset = event.when() - curTick(); - paramOut(os, base + ".event_tick_offset", event_tick_offset); + paramOut(cp, base + ".event_tick_offset", event_tick_offset); } void -Intel8254Timer::Counter::unserialize(const string &base, Checkpoint *cp, - const string §ion) +Intel8254Timer::Counter::unserialize(const string &base, CheckpointIn &cp) { - paramIn(cp, section, base + ".initial_count", initial_count); - paramIn(cp, section, base + ".latched_count", latched_count); - paramIn(cp, section, base + ".period", period); - paramIn(cp, section, base + ".mode", mode); - paramIn(cp, section, base + ".output_high", output_high); - paramIn(cp, section, base + ".latch_on", latch_on); - paramIn(cp, section, base + ".read_byte", read_byte); - paramIn(cp, section, base + ".write_byte", write_byte); + paramIn(cp, base + ".initial_count", initial_count); + paramIn(cp, base + ".latched_count", latched_count); + paramIn(cp, base + ".period", period); + paramIn(cp, base + ".mode", mode); + paramIn(cp, base + ".output_high", output_high); + paramIn(cp, base + ".latch_on", latch_on); + paramIn(cp, base + ".read_byte", read_byte); + paramIn(cp, base + ".write_byte", write_byte); Tick event_tick_offset = 0; assert(!event.scheduled()); - paramIn(cp, section, base + ".event_tick_offset", event_tick_offset); + paramIn(cp, base + ".event_tick_offset", event_tick_offset); offset = event_tick_offset; } diff --git a/src/dev/intel_8254_timer.hh b/src/dev/intel_8254_timer.hh index b2fd949f2..86b91620d 100644 --- a/src/dev/intel_8254_timer.hh +++ b/src/dev/intel_8254_timer.hh @@ -179,7 +179,7 @@ class Intel8254Timer : public EventManager * @param base The base name of the counter object. * @param os The stream to serialize to. */ - void serialize(const std::string &base, std::ostream &os); + void serialize(const std::string &base, CheckpointOut &cp) const; /** * Reconstruct the state of this object from a checkpoint. @@ -187,8 +187,7 @@ class Intel8254Timer : public EventManager * @param cp The checkpoint use. * @param section The section name of this object */ - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void unserialize(const std::string &base, CheckpointIn &cp); /** Start ticking */ void startup(); @@ -247,7 +246,7 @@ class Intel8254Timer : public EventManager * @param base The base name of the counter object. * @param os The stream to serialize to. */ - void serialize(const std::string &base, std::ostream &os); + void serialize(const std::string &base, CheckpointOut &cp) const; /** * Reconstruct the state of this object from a checkpoint. @@ -255,8 +254,7 @@ class Intel8254Timer : public EventManager * @param cp The checkpoint use. * @param section The section name of this object */ - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void unserialize(const std::string &base, CheckpointIn &cp); /** Start ticking */ void startup(); diff --git a/src/dev/mc146818.cc b/src/dev/mc146818.cc index b5467f8cc..02c302bae 100644 --- a/src/dev/mc146818.cc +++ b/src/dev/mc146818.cc @@ -265,14 +265,14 @@ MC146818::tickClock() } void -MC146818::serialize(const string &base, ostream &os) +MC146818::serialize(const string &base, CheckpointOut &cp) const { uint8_t regA_serial(stat_regA); uint8_t regB_serial(stat_regB); - arrayParamOut(os, base + ".clock_data", clock_data, sizeof(clock_data)); - paramOut(os, base + ".stat_regA", (uint8_t)regA_serial); - paramOut(os, base + ".stat_regB", (uint8_t)regB_serial); + arrayParamOut(cp, base + ".clock_data", clock_data, sizeof(clock_data)); + paramOut(cp, base + ".stat_regA", (uint8_t)regA_serial); + paramOut(cp, base + ".stat_regB", (uint8_t)regB_serial); // // save the timer tick and rtc clock tick values to correctly reschedule @@ -285,17 +285,16 @@ MC146818::serialize(const string &base, ostream &os) } void -MC146818::unserialize(const string &base, Checkpoint *cp, - const string §ion) +MC146818::unserialize(const string &base, CheckpointIn &cp) { uint8_t tmp8; - arrayParamIn(cp, section, base + ".clock_data", clock_data, + arrayParamIn(cp, base + ".clock_data", clock_data, sizeof(clock_data)); - paramIn(cp, section, base + ".stat_regA", tmp8); + paramIn(cp, base + ".stat_regA", tmp8); stat_regA = tmp8; - paramIn(cp, section, base + ".stat_regB", tmp8); + paramIn(cp, base + ".stat_regB", tmp8); stat_regB = tmp8; // diff --git a/src/dev/mc146818.hh b/src/dev/mc146818.hh index 936f597d0..e19040ec3 100644 --- a/src/dev/mc146818.hh +++ b/src/dev/mc146818.hh @@ -170,7 +170,7 @@ class MC146818 : public EventManager * @param base The base name of the counter object. * @param os The stream to serialize to. */ - void serialize(const std::string &base, std::ostream &os); + void serialize(const std::string &base, CheckpointOut &cp) const; /** * Reconstruct the state of this object from a checkpoint. @@ -178,8 +178,7 @@ class MC146818 : public EventManager * @param cp The checkpoint use. * @param section The section name of this object */ - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void unserialize(const std::string &base, CheckpointIn &cp); }; #endif // __DEV_MC146818_HH__ diff --git a/src/dev/mips/malta.cc b/src/dev/mips/malta.cc index 277633c6b..0c37e2713 100755 --- a/src/dev/mips/malta.cc +++ b/src/dev/mips/malta.cc @@ -91,13 +91,13 @@ Malta::pciToDma(Addr pciAddr) const } void -Malta::serialize(std::ostream &os) +Malta::serialize(CheckpointOut &cp) const { SERIALIZE_ARRAY(intr_sum_type, Malta::Max_CPUs); } void -Malta::unserialize(Checkpoint *cp, const std::string §ion) +Malta::unserialize(CheckpointIn &cp) { UNSERIALIZE_ARRAY(intr_sum_type, Malta::Max_CPUs); } diff --git a/src/dev/mips/malta.hh b/src/dev/mips/malta.hh index e612fb295..c5ee92e3d 100755 --- a/src/dev/mips/malta.hh +++ b/src/dev/mips/malta.hh @@ -135,18 +135,8 @@ class Malta : public Platform M5_DUMMY_RETURN } - /** - * 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); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __DEV_MALTA_HH__ diff --git a/src/dev/mips/malta_cchip.cc b/src/dev/mips/malta_cchip.cc index dc5211122..34f79b65b 100755 --- a/src/dev/mips/malta_cchip.cc +++ b/src/dev/mips/malta_cchip.cc @@ -501,7 +501,7 @@ MaltaCChip::clearIntr(uint32_t interrupt) void -MaltaCChip::serialize(std::ostream &os) +MaltaCChip::serialize(CheckpointOut &cp) const { // SERIALIZE_ARRAY(dim, Malta::Max_CPUs); //SERIALIZE_ARRAY(dir, Malta::Max_CPUs); @@ -511,7 +511,7 @@ MaltaCChip::serialize(std::ostream &os) } void -MaltaCChip::unserialize(Checkpoint *cp, const std::string §ion) +MaltaCChip::unserialize(CheckpointIn &cp) { //UNSERIALIZE_ARRAY(dim, Malta::Max_CPUs); //UNSERIALIZE_ARRAY(dir, Malta::Max_CPUs); diff --git a/src/dev/mips/malta_cchip.hh b/src/dev/mips/malta_cchip.hh index 9a17f632f..707cd1048 100755 --- a/src/dev/mips/malta_cchip.hh +++ b/src/dev/mips/malta_cchip.hh @@ -133,20 +133,8 @@ class MaltaCChip : public BasicPioDevice */ void reqIPI(uint64_t ipreq); - - /** - * 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); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __MALTA_CCHIP_HH__ diff --git a/src/dev/mips/malta_io.cc b/src/dev/mips/malta_io.cc index d79e43260..bd3791163 100755 --- a/src/dev/mips/malta_io.cc +++ b/src/dev/mips/malta_io.cc @@ -111,7 +111,7 @@ MaltaIO::clearIntr(uint8_t interrupt) } void -MaltaIO::serialize(ostream &os) +MaltaIO::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(timerData); SERIALIZE_SCALAR(mask1); @@ -122,12 +122,12 @@ MaltaIO::serialize(ostream &os) SERIALIZE_SCALAR(picInterrupting); // Serialize the timers - pitimer.serialize("pitimer", os); - rtc.serialize("rtc", os); + pitimer.serialize("pitimer", cp); + rtc.serialize("rtc", cp); } void -MaltaIO::unserialize(Checkpoint *cp, const string §ion) +MaltaIO::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(timerData); UNSERIALIZE_SCALAR(mask1); @@ -138,8 +138,8 @@ MaltaIO::unserialize(Checkpoint *cp, const string §ion) UNSERIALIZE_SCALAR(picInterrupting); // Unserialize the timers - pitimer.unserialize("pitimer", cp, section); - rtc.unserialize("rtc", cp, section); + pitimer.unserialize("pitimer", cp); + rtc.unserialize("rtc", cp); } void diff --git a/src/dev/mips/malta_io.hh b/src/dev/mips/malta_io.hh index dd035aea2..bea6733fc 100755 --- a/src/dev/mips/malta_io.hh +++ b/src/dev/mips/malta_io.hh @@ -130,18 +130,8 @@ class MaltaIO : public BasicPioDevice /** Clear an Interrupt to the CPU */ void clearIntr(uint8_t interrupt); - /** - * 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); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** * Start running. diff --git a/src/dev/mips/malta_pchip.cc b/src/dev/mips/malta_pchip.cc index bee61fddd..d0ae3daaa 100755 --- a/src/dev/mips/malta_pchip.cc +++ b/src/dev/mips/malta_pchip.cc @@ -312,7 +312,7 @@ MaltaPChip::calcConfigAddr(int bus, int dev, int func) void -MaltaPChip::serialize(std::ostream &os) +MaltaPChip::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(pctl); SERIALIZE_ARRAY(wsba, 4); @@ -321,7 +321,7 @@ MaltaPChip::serialize(std::ostream &os) } void -MaltaPChip::unserialize(Checkpoint *cp, const std::string §ion) +MaltaPChip::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(pctl); UNSERIALIZE_ARRAY(wsba, 4); diff --git a/src/dev/mips/malta_pchip.hh b/src/dev/mips/malta_pchip.hh index a6145515a..368faf9c5 100755 --- a/src/dev/mips/malta_pchip.hh +++ b/src/dev/mips/malta_pchip.hh @@ -88,18 +88,8 @@ class MaltaPChip : public BasicPioDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - /** - * 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); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __TSUNAMI_PCHIP_HH__ diff --git a/src/dev/ns_gige.cc b/src/dev/ns_gige.cc index d87975759..c525f6359 100644 --- a/src/dev/ns_gige.cc +++ b/src/dev/ns_gige.cc @@ -2123,10 +2123,10 @@ NSGigE::drainResume() // // void -NSGigE::serialize(ostream &os) +NSGigE::serialize(CheckpointOut &cp) const { // Serialize the PciDevice base class - PciDevice::serialize(os); + PciDevice::serialize(cp); /* * Finalize any DMA events now. @@ -2179,8 +2179,8 @@ NSGigE::serialize(ostream &os) /* * Serialize the data Fifos */ - rxFifo.serialize("rxFifo", os); - txFifo.serialize("txFifo", os); + rxFifo.serialize("rxFifo", cp); + txFifo.serialize("txFifo", cp); /* * Serialize the various helper variables @@ -2189,7 +2189,7 @@ NSGigE::serialize(ostream &os) SERIALIZE_SCALAR(txPacketExists); if (txPacketExists) { txPacket->length = txPacketBufPtr - txPacket->data; - txPacket->serialize("txPacket", os); + txPacket->serialize("txPacket", cp); uint32_t txPktBufPtr = (uint32_t) (txPacketBufPtr - txPacket->data); SERIALIZE_SCALAR(txPktBufPtr); } @@ -2197,7 +2197,7 @@ NSGigE::serialize(ostream &os) bool rxPacketExists = rxPacket != nullptr; SERIALIZE_SCALAR(rxPacketExists); if (rxPacketExists) { - rxPacket->serialize("rxPacket", os); + rxPacket->serialize("rxPacket", cp); uint32_t rxPktBufPtr = (uint32_t) (rxPacketBufPtr - rxPacket->data); SERIALIZE_SCALAR(rxPktBufPtr); } @@ -2295,10 +2295,10 @@ NSGigE::serialize(ostream &os) } void -NSGigE::unserialize(Checkpoint *cp, const std::string §ion) +NSGigE::unserialize(CheckpointIn &cp) { // Unserialize the PciDevice base class - PciDevice::unserialize(cp, section); + PciDevice::unserialize(cp); UNSERIALIZE_SCALAR(regs.command); UNSERIALIZE_SCALAR(regs.config); @@ -2343,8 +2343,8 @@ NSGigE::unserialize(Checkpoint *cp, const std::string §ion) /* * unserialize the data fifos */ - rxFifo.unserialize("rxFifo", cp, section); - txFifo.unserialize("txFifo", cp, section); + rxFifo.unserialize("rxFifo", cp); + txFifo.unserialize("txFifo", cp); /* * unserialize the various helper variables @@ -2353,7 +2353,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(txPacketExists); if (txPacketExists) { txPacket = make_shared<EthPacketData>(16384); - txPacket->unserialize("txPacket", cp, section); + txPacket->unserialize("txPacket", cp); uint32_t txPktBufPtr; UNSERIALIZE_SCALAR(txPktBufPtr); txPacketBufPtr = (uint8_t *) txPacket->data + txPktBufPtr; @@ -2365,7 +2365,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string §ion) rxPacket = 0; if (rxPacketExists) { rxPacket = make_shared<EthPacketData>(16384); - rxPacket->unserialize("rxPacket", cp, section); + rxPacket->unserialize("rxPacket", cp); uint32_t rxPktBufPtr; UNSERIALIZE_SCALAR(rxPktBufPtr); rxPacketBufPtr = (uint8_t *) rxPacket->data + rxPktBufPtr; diff --git a/src/dev/ns_gige.hh b/src/dev/ns_gige.hh index 6d5068a2b..f8e9be853 100644 --- a/src/dev/ns_gige.hh +++ b/src/dev/ns_gige.hh @@ -366,8 +366,8 @@ class NSGigE : public EtherDevBase bool recvPacket(EthPacketPtr packet); void transferDone(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; void drainResume(); }; diff --git a/src/dev/pcidev.cc b/src/dev/pcidev.cc index 40be9716d..581ae2ebd 100644 --- a/src/dev/pcidev.cc +++ b/src/dev/pcidev.cc @@ -473,29 +473,29 @@ PciDevice::writeConfig(PacketPtr pkt) } void -PciDevice::serialize(std::ostream &os) +PciDevice::serialize(CheckpointOut &cp) const { SERIALIZE_ARRAY(BARSize, sizeof(BARSize) / sizeof(BARSize[0])); SERIALIZE_ARRAY(BARAddrs, sizeof(BARAddrs) / sizeof(BARAddrs[0])); SERIALIZE_ARRAY(config.data, sizeof(config.data) / sizeof(config.data[0])); // serialize the capability list registers - paramOut(os, csprintf("pmcap.pid"), uint16_t(pmcap.pid)); - paramOut(os, csprintf("pmcap.pc"), uint16_t(pmcap.pc)); - paramOut(os, csprintf("pmcap.pmcs"), uint16_t(pmcap.pmcs)); + paramOut(cp, csprintf("pmcap.pid"), uint16_t(pmcap.pid)); + paramOut(cp, csprintf("pmcap.pc"), uint16_t(pmcap.pc)); + paramOut(cp, csprintf("pmcap.pmcs"), uint16_t(pmcap.pmcs)); - paramOut(os, csprintf("msicap.mid"), uint16_t(msicap.mid)); - paramOut(os, csprintf("msicap.mc"), uint16_t(msicap.mc)); - paramOut(os, csprintf("msicap.ma"), uint32_t(msicap.ma)); + paramOut(cp, csprintf("msicap.mid"), uint16_t(msicap.mid)); + paramOut(cp, csprintf("msicap.mc"), uint16_t(msicap.mc)); + paramOut(cp, csprintf("msicap.ma"), uint32_t(msicap.ma)); SERIALIZE_SCALAR(msicap.mua); - paramOut(os, csprintf("msicap.md"), uint16_t(msicap.md)); + paramOut(cp, csprintf("msicap.md"), uint16_t(msicap.md)); SERIALIZE_SCALAR(msicap.mmask); SERIALIZE_SCALAR(msicap.mpend); - paramOut(os, csprintf("msixcap.mxid"), uint16_t(msixcap.mxid)); - paramOut(os, csprintf("msixcap.mxc"), uint16_t(msixcap.mxc)); - paramOut(os, csprintf("msixcap.mtab"), uint32_t(msixcap.mtab)); - paramOut(os, csprintf("msixcap.mpba"), uint32_t(msixcap.mpba)); + paramOut(cp, csprintf("msixcap.mxid"), uint16_t(msixcap.mxid)); + paramOut(cp, csprintf("msixcap.mxc"), uint16_t(msixcap.mxc)); + paramOut(cp, csprintf("msixcap.mtab"), uint32_t(msixcap.mtab)); + paramOut(cp, csprintf("msixcap.mpba"), uint32_t(msixcap.mpba)); // Only serialize if we have a non-zero base address if (MSIXCAP_BASE != 0x0) { @@ -510,35 +510,35 @@ PciDevice::serialize(std::ostream &os) SERIALIZE_SCALAR(pba_array_size); for (int i = 0; i < msix_array_size; i++) { - paramOut(os, csprintf("msix_table[%d].addr_lo", i), + paramOut(cp, csprintf("msix_table[%d].addr_lo", i), msix_table[i].fields.addr_lo); - paramOut(os, csprintf("msix_table[%d].addr_hi", i), + paramOut(cp, csprintf("msix_table[%d].addr_hi", i), msix_table[i].fields.addr_hi); - paramOut(os, csprintf("msix_table[%d].msg_data", i), + paramOut(cp, csprintf("msix_table[%d].msg_data", i), msix_table[i].fields.msg_data); - paramOut(os, csprintf("msix_table[%d].vec_ctrl", i), + paramOut(cp, csprintf("msix_table[%d].vec_ctrl", i), msix_table[i].fields.vec_ctrl); } for (int i = 0; i < pba_array_size; i++) { - paramOut(os, csprintf("msix_pba[%d].bits", i), + paramOut(cp, csprintf("msix_pba[%d].bits", i), msix_pba[i].bits); } } - paramOut(os, csprintf("pxcap.pxid"), uint16_t(pxcap.pxid)); - paramOut(os, csprintf("pxcap.pxcap"), uint16_t(pxcap.pxcap)); - paramOut(os, csprintf("pxcap.pxdcap"), uint32_t(pxcap.pxdcap)); - paramOut(os, csprintf("pxcap.pxdc"), uint16_t(pxcap.pxdc)); - paramOut(os, csprintf("pxcap.pxds"), uint16_t(pxcap.pxds)); - paramOut(os, csprintf("pxcap.pxlcap"), uint32_t(pxcap.pxlcap)); - paramOut(os, csprintf("pxcap.pxlc"), uint16_t(pxcap.pxlc)); - paramOut(os, csprintf("pxcap.pxls"), uint16_t(pxcap.pxls)); - paramOut(os, csprintf("pxcap.pxdcap2"), uint32_t(pxcap.pxdcap2)); - paramOut(os, csprintf("pxcap.pxdc2"), uint32_t(pxcap.pxdc2)); + paramOut(cp, csprintf("pxcap.pxid"), uint16_t(pxcap.pxid)); + paramOut(cp, csprintf("pxcap.pxcap"), uint16_t(pxcap.pxcap)); + paramOut(cp, csprintf("pxcap.pxdcap"), uint32_t(pxcap.pxdcap)); + paramOut(cp, csprintf("pxcap.pxdc"), uint16_t(pxcap.pxdc)); + paramOut(cp, csprintf("pxcap.pxds"), uint16_t(pxcap.pxds)); + paramOut(cp, csprintf("pxcap.pxlcap"), uint32_t(pxcap.pxlcap)); + paramOut(cp, csprintf("pxcap.pxlc"), uint16_t(pxcap.pxlc)); + paramOut(cp, csprintf("pxcap.pxls"), uint16_t(pxcap.pxls)); + paramOut(cp, csprintf("pxcap.pxdcap2"), uint32_t(pxcap.pxdcap2)); + paramOut(cp, csprintf("pxcap.pxdc2"), uint32_t(pxcap.pxdc2)); } void -PciDevice::unserialize(Checkpoint *cp, const std::string §ion) +PciDevice::unserialize(CheckpointIn &cp) { UNSERIALIZE_ARRAY(BARSize, sizeof(BARSize) / sizeof(BARSize[0])); UNSERIALIZE_ARRAY(BARAddrs, sizeof(BARAddrs) / sizeof(BARAddrs[0])); @@ -548,32 +548,32 @@ PciDevice::unserialize(Checkpoint *cp, const std::string §ion) // unserialize the capability list registers uint16_t tmp16; uint32_t tmp32; - paramIn(cp, section, csprintf("pmcap.pid"), tmp16); + paramIn(cp, csprintf("pmcap.pid"), tmp16); pmcap.pid = tmp16; - paramIn(cp, section, csprintf("pmcap.pc"), tmp16); + paramIn(cp, csprintf("pmcap.pc"), tmp16); pmcap.pc = tmp16; - paramIn(cp, section, csprintf("pmcap.pmcs"), tmp16); + paramIn(cp, csprintf("pmcap.pmcs"), tmp16); pmcap.pmcs = tmp16; - paramIn(cp, section, csprintf("msicap.mid"), tmp16); + paramIn(cp, csprintf("msicap.mid"), tmp16); msicap.mid = tmp16; - paramIn(cp, section, csprintf("msicap.mc"), tmp16); + paramIn(cp, csprintf("msicap.mc"), tmp16); msicap.mc = tmp16; - paramIn(cp, section, csprintf("msicap.ma"), tmp32); + paramIn(cp, csprintf("msicap.ma"), tmp32); msicap.ma = tmp32; UNSERIALIZE_SCALAR(msicap.mua); - paramIn(cp, section, csprintf("msicap.md"), tmp16);; + paramIn(cp, csprintf("msicap.md"), tmp16);; msicap.md = tmp16; UNSERIALIZE_SCALAR(msicap.mmask); UNSERIALIZE_SCALAR(msicap.mpend); - paramIn(cp, section, csprintf("msixcap.mxid"), tmp16); + paramIn(cp, csprintf("msixcap.mxid"), tmp16); msixcap.mxid = tmp16; - paramIn(cp, section, csprintf("msixcap.mxc"), tmp16); + paramIn(cp, csprintf("msixcap.mxc"), tmp16); msixcap.mxc = tmp16; - paramIn(cp, section, csprintf("msixcap.mtab"), tmp32); + paramIn(cp, csprintf("msixcap.mtab"), tmp32); msixcap.mtab = tmp32; - paramIn(cp, section, csprintf("msixcap.mpba"), tmp32); + paramIn(cp, csprintf("msixcap.mpba"), tmp32); msixcap.mpba = tmp32; // Only allocate if MSIXCAP_BASE is not 0x0 @@ -591,40 +591,40 @@ PciDevice::unserialize(Checkpoint *cp, const std::string §ion) msix_pba.resize(pba_array_size, tmp2); for (int i = 0; i < msix_array_size; i++) { - paramIn(cp, section, csprintf("msix_table[%d].addr_lo", i), + paramIn(cp, csprintf("msix_table[%d].addr_lo", i), msix_table[i].fields.addr_lo); - paramIn(cp, section, csprintf("msix_table[%d].addr_hi", i), + paramIn(cp, csprintf("msix_table[%d].addr_hi", i), msix_table[i].fields.addr_hi); - paramIn(cp, section, csprintf("msix_table[%d].msg_data", i), + paramIn(cp, csprintf("msix_table[%d].msg_data", i), msix_table[i].fields.msg_data); - paramIn(cp, section, csprintf("msix_table[%d].vec_ctrl", i), + paramIn(cp, csprintf("msix_table[%d].vec_ctrl", i), msix_table[i].fields.vec_ctrl); } for (int i = 0; i < pba_array_size; i++) { - paramIn(cp, section, csprintf("msix_pba[%d].bits", i), + paramIn(cp, csprintf("msix_pba[%d].bits", i), msix_pba[i].bits); } } - paramIn(cp, section, csprintf("pxcap.pxid"), tmp16); + paramIn(cp, csprintf("pxcap.pxid"), tmp16); pxcap.pxid = tmp16; - paramIn(cp, section, csprintf("pxcap.pxcap"), tmp16); + paramIn(cp, csprintf("pxcap.pxcap"), tmp16); pxcap.pxcap = tmp16; - paramIn(cp, section, csprintf("pxcap.pxdcap"), tmp32); + paramIn(cp, csprintf("pxcap.pxdcap"), tmp32); pxcap.pxdcap = tmp32; - paramIn(cp, section, csprintf("pxcap.pxdc"), tmp16); + paramIn(cp, csprintf("pxcap.pxdc"), tmp16); pxcap.pxdc = tmp16; - paramIn(cp, section, csprintf("pxcap.pxds"), tmp16); + paramIn(cp, csprintf("pxcap.pxds"), tmp16); pxcap.pxds = tmp16; - paramIn(cp, section, csprintf("pxcap.pxlcap"), tmp32); + paramIn(cp, csprintf("pxcap.pxlcap"), tmp32); pxcap.pxlcap = tmp32; - paramIn(cp, section, csprintf("pxcap.pxlc"), tmp16); + paramIn(cp, csprintf("pxcap.pxlc"), tmp16); pxcap.pxlc = tmp16; - paramIn(cp, section, csprintf("pxcap.pxls"), tmp16); + paramIn(cp, csprintf("pxcap.pxls"), tmp16); pxcap.pxls = tmp16; - paramIn(cp, section, csprintf("pxcap.pxdcap2"), tmp32); + paramIn(cp, csprintf("pxcap.pxdcap2"), tmp32); pxcap.pxdcap2 = tmp32; - paramIn(cp, section, csprintf("pxcap.pxdc2"), tmp32); + paramIn(cp, csprintf("pxcap.pxdc2"), tmp32); pxcap.pxdc2 = tmp32; pioPort.sendRangeChange(); } diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh index 1c29293a6..4f997932b 100644 --- a/src/dev/pcidev.hh +++ b/src/dev/pcidev.hh @@ -249,14 +249,14 @@ class PciDevice : public DmaDevice * Serialize this object to the given output stream. * @param os The stream to serialize to. */ - virtual void serialize(std::ostream &os); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; /** * 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); + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; virtual unsigned int drain(DrainManager *dm); diff --git a/src/dev/pktfifo.cc b/src/dev/pktfifo.cc index efd8b083d..fb2564b71 100644 --- a/src/dev/pktfifo.cc +++ b/src/dev/pktfifo.cc @@ -65,58 +65,51 @@ PacketFifo::copyout(void *dest, unsigned offset, unsigned len) void -PacketFifoEntry::serialize(const string &base, ostream &os) +PacketFifoEntry::serialize(const string &base, CheckpointOut &cp) const { - packet->serialize(base + ".packet", os); - paramOut(os, base + ".slack", slack); - paramOut(os, base + ".number", number); - paramOut(os, base + ".priv", priv); + packet->serialize(base + ".packet", cp); + paramOut(cp, base + ".slack", slack); + paramOut(cp, base + ".number", number); + paramOut(cp, base + ".priv", priv); } void -PacketFifoEntry::unserialize(const string &base, Checkpoint *cp, - const string §ion) +PacketFifoEntry::unserialize(const string &base, CheckpointIn &cp) { packet = make_shared<EthPacketData>(16384); - packet->unserialize(base + ".packet", cp, section); - paramIn(cp, section, base + ".slack", slack); - paramIn(cp, section, base + ".number", number); - paramIn(cp, section, base + ".priv", priv); + packet->unserialize(base + ".packet", cp); + paramIn(cp, base + ".slack", slack); + paramIn(cp, base + ".number", number); + paramIn(cp, base + ".priv", priv); } void -PacketFifo::serialize(const string &base, ostream &os) +PacketFifo::serialize(const string &base, CheckpointOut &cp) const { - paramOut(os, base + ".size", _size); - paramOut(os, base + ".maxsize", _maxsize); - paramOut(os, base + ".reserved", _reserved); - paramOut(os, base + ".packets", fifo.size()); + paramOut(cp, base + ".size", _size); + paramOut(cp, base + ".maxsize", _maxsize); + paramOut(cp, base + ".reserved", _reserved); + paramOut(cp, base + ".packets", fifo.size()); int i = 0; - iterator entry = fifo.begin(); - iterator end = fifo.end(); - while (entry != end) { - entry->serialize(csprintf("%s.entry%d", base, i), os); - ++entry; - ++i; - } + for (const auto &entry : fifo) + entry.serialize(csprintf("%s.entry%d", base, i++), cp); } void -PacketFifo::unserialize(const string &base, Checkpoint *cp, - const string §ion) +PacketFifo::unserialize(const string &base, CheckpointIn &cp) { - paramIn(cp, section, base + ".size", _size); -// paramIn(cp, section, base + ".maxsize", _maxsize); - paramIn(cp, section, base + ".reserved", _reserved); + paramIn(cp, base + ".size", _size); +// paramIn(cp, base + ".maxsize", _maxsize); + paramIn(cp, base + ".reserved", _reserved); int fifosize; - paramIn(cp, section, base + ".packets", fifosize); + paramIn(cp, base + ".packets", fifosize); fifo.clear(); for (int i = 0; i < fifosize; ++i) { PacketFifoEntry entry; - entry.unserialize(csprintf("%s.entry%d", base, i), cp, section); + entry.unserialize(csprintf("%s.entry%d", base, i), cp); fifo.push_back(entry); } } diff --git a/src/dev/pktfifo.hh b/src/dev/pktfifo.hh index b548627e0..95d46fc76 100644 --- a/src/dev/pktfifo.hh +++ b/src/dev/pktfifo.hh @@ -70,9 +70,8 @@ struct PacketFifoEntry priv = -1; } - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void serialize(const std::string &base, CheckpointOut &cp) const; + void unserialize(const std::string &base, CheckpointIn &cp); }; class PacketFifo @@ -201,9 +200,8 @@ class PacketFifo * Serialization stuff */ public: - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, - Checkpoint *cp, const std::string §ion); + void serialize(const std::string &base, CheckpointOut &cp) const; + void unserialize(const std::string &base, CheckpointIn &cp); }; #endif // __DEV_PKTFIFO_HH__ diff --git a/src/dev/sinic.cc b/src/dev/sinic.cc index a5608fb36..d5a05b319 100644 --- a/src/dev/sinic.cc +++ b/src/dev/sinic.cc @@ -1259,10 +1259,10 @@ Device::drainResume() // // void -Base::serialize(std::ostream &os) +Base::serialize(CheckpointOut &cp) const { // Serialize the PciDevice base class - PciDevice::serialize(os); + PciDevice::serialize(cp); SERIALIZE_SCALAR(rxEnable); SERIALIZE_SCALAR(txEnable); @@ -1280,10 +1280,10 @@ Base::serialize(std::ostream &os) } void -Base::unserialize(Checkpoint *cp, const std::string §ion) +Base::unserialize(CheckpointIn &cp) { // Unserialize the PciDevice base class - PciDevice::unserialize(cp, section); + PciDevice::unserialize(cp); UNSERIALIZE_SCALAR(rxEnable); UNSERIALIZE_SCALAR(txEnable); @@ -1303,12 +1303,12 @@ Base::unserialize(Checkpoint *cp, const std::string §ion) } void -Device::serialize(std::ostream &os) +Device::serializeOld(CheckpointOut &cp) { int count; // Serialize the PciDevice base class - Base::serialize(os); + Base::serialize(cp); if (rxState == rxCopy) panic("can't serialize with an in flight dma request rxState=%s", @@ -1333,16 +1333,16 @@ Device::serialize(std::ostream &os) int virtualRegsSize = virtualRegs.size(); SERIALIZE_SCALAR(virtualRegsSize); for (int i = 0; i < virtualRegsSize; ++i) { - VirtualReg *vnic = &virtualRegs[i]; + const VirtualReg *vnic = &virtualRegs[i]; std::string reg = csprintf("vnic%d", i); - paramOut(os, reg + ".RxData", vnic->RxData); - paramOut(os, reg + ".RxDone", vnic->RxDone); - paramOut(os, reg + ".TxData", vnic->TxData); - paramOut(os, reg + ".TxDone", vnic->TxDone); + paramOut(cp, reg + ".RxData", vnic->RxData); + paramOut(cp, reg + ".RxDone", vnic->RxDone); + paramOut(cp, reg + ".TxData", vnic->TxData); + paramOut(cp, reg + ".TxDone", vnic->TxDone); bool rxPacketExists = vnic->rxIndex != rxFifo.end(); - paramOut(os, reg + ".rxPacketExists", rxPacketExists); + paramOut(cp, reg + ".rxPacketExists", rxPacketExists); if (rxPacketExists) { int rxPacket = 0; PacketFifo::iterator i = rxFifo.begin(); @@ -1352,11 +1352,11 @@ Device::serialize(std::ostream &os) ++rxPacket; } - paramOut(os, reg + ".rxPacket", rxPacket); - paramOut(os, reg + ".rxPacketOffset", vnic->rxPacketOffset); - paramOut(os, reg + ".rxPacketBytes", vnic->rxPacketBytes); + paramOut(cp, reg + ".rxPacket", rxPacket); + paramOut(cp, reg + ".rxPacketOffset", vnic->rxPacketOffset); + paramOut(cp, reg + ".rxPacketBytes", vnic->rxPacketBytes); } - paramOut(os, reg + ".rxDoneData", vnic->rxDoneData); + paramOut(cp, reg + ".rxDoneData", vnic->rxDoneData); } int rxFifoPtr = -1; @@ -1371,17 +1371,17 @@ Device::serialize(std::ostream &os) VirtualList::iterator i, end; for (count = 0, i = rxList.begin(), end = rxList.end(); i != end; ++i) - paramOut(os, csprintf("rxList%d", count++), *i); + paramOut(cp, csprintf("rxList%d", count++), *i); int rxListSize = count; SERIALIZE_SCALAR(rxListSize); for (count = 0, i = rxBusy.begin(), end = rxBusy.end(); i != end; ++i) - paramOut(os, csprintf("rxBusy%d", count++), *i); + paramOut(cp, csprintf("rxBusy%d", count++), *i); int rxBusySize = count; SERIALIZE_SCALAR(rxBusySize); for (count = 0, i = txList.begin(), end = txList.end(); i != end; ++i) - paramOut(os, csprintf("txList%d", count++), *i); + paramOut(cp, csprintf("txList%d", count++), *i); int txListSize = count; SERIALIZE_SCALAR(txListSize); @@ -1392,7 +1392,7 @@ Device::serialize(std::ostream &os) SERIALIZE_SCALAR(rxState); SERIALIZE_SCALAR(rxEmpty); SERIALIZE_SCALAR(rxLow); - rxFifo.serialize("rxFifo", os); + rxFifo.serialize("rxFifo", cp); /* * Serialize tx state machine @@ -1400,11 +1400,11 @@ Device::serialize(std::ostream &os) int txState = this->txState; SERIALIZE_SCALAR(txState); SERIALIZE_SCALAR(txFull); - txFifo.serialize("txFifo", os); + txFifo.serialize("txFifo", cp); bool txPacketExists = txPacket != nullptr; SERIALIZE_SCALAR(txPacketExists); if (txPacketExists) { - txPacket->serialize("txPacket", os); + txPacket->serialize("txPacket", cp); SERIALIZE_SCALAR(txPacketOffset); SERIALIZE_SCALAR(txPacketBytes); } @@ -1418,10 +1418,10 @@ Device::serialize(std::ostream &os) } void -Device::unserialize(Checkpoint *cp, const std::string §ion) +Device::unserialize(CheckpointIn &cp) { // Unserialize the PciDevice base class - Base::unserialize(cp, section); + Base::unserialize(cp); /* * Unserialize the device registers that may have been written by the OS. @@ -1442,7 +1442,7 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) rxList.clear(); for (int i = 0; i < rxListSize; ++i) { int value; - paramIn(cp, section, csprintf("rxList%d", i), value); + paramIn(cp, csprintf("rxList%d", i), value); rxList.push_back(value); } @@ -1451,7 +1451,7 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) rxBusy.clear(); for (int i = 0; i < rxBusySize; ++i) { int value; - paramIn(cp, section, csprintf("rxBusy%d", i), value); + paramIn(cp, csprintf("rxBusy%d", i), value); rxBusy.push_back(value); } @@ -1460,7 +1460,7 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) txList.clear(); for (int i = 0; i < txListSize; ++i) { int value; - paramIn(cp, section, csprintf("txList%d", i), value); + paramIn(cp, csprintf("txList%d", i), value); txList.push_back(value); } @@ -1472,7 +1472,7 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(rxEmpty); UNSERIALIZE_SCALAR(rxLow); this->rxState = (RxState) rxState; - rxFifo.unserialize("rxFifo", cp, section); + rxFifo.unserialize("rxFifo", cp); int rxFifoPtr; UNSERIALIZE_SCALAR(rxFifoPtr); @@ -1491,13 +1491,13 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(txState); UNSERIALIZE_SCALAR(txFull); this->txState = (TxState) txState; - txFifo.unserialize("txFifo", cp, section); + txFifo.unserialize("txFifo", cp); bool txPacketExists; UNSERIALIZE_SCALAR(txPacketExists); txPacket = 0; if (txPacketExists) { txPacket = make_shared<EthPacketData>(16384); - txPacket->unserialize("txPacket", cp, section); + txPacket->unserialize("txPacket", cp); UNSERIALIZE_SCALAR(txPacketOffset); UNSERIALIZE_SCALAR(txPacketBytes); } @@ -1516,30 +1516,30 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) VirtualReg *vnic = &virtualRegs[i]; std::string reg = csprintf("vnic%d", i); - paramIn(cp, section, reg + ".RxData", vnic->RxData); - paramIn(cp, section, reg + ".RxDone", vnic->RxDone); - paramIn(cp, section, reg + ".TxData", vnic->TxData); - paramIn(cp, section, reg + ".TxDone", vnic->TxDone); + paramIn(cp, reg + ".RxData", vnic->RxData); + paramIn(cp, reg + ".RxDone", vnic->RxDone); + paramIn(cp, reg + ".TxData", vnic->TxData); + paramIn(cp, reg + ".TxDone", vnic->TxDone); vnic->rxUnique = rxUnique++; vnic->txUnique = txUnique++; bool rxPacketExists; - paramIn(cp, section, reg + ".rxPacketExists", rxPacketExists); + paramIn(cp, reg + ".rxPacketExists", rxPacketExists); if (rxPacketExists) { int rxPacket; - paramIn(cp, section, reg + ".rxPacket", rxPacket); + paramIn(cp, reg + ".rxPacket", rxPacket); vnic->rxIndex = rxFifo.begin(); while (rxPacket--) ++vnic->rxIndex; - paramIn(cp, section, reg + ".rxPacketOffset", + paramIn(cp, reg + ".rxPacketOffset", vnic->rxPacketOffset); - paramIn(cp, section, reg + ".rxPacketBytes", vnic->rxPacketBytes); + paramIn(cp, reg + ".rxPacketBytes", vnic->rxPacketBytes); } else { vnic->rxIndex = rxFifo.end(); } - paramIn(cp, section, reg + ".rxDoneData", vnic->rxDoneData); + paramIn(cp, reg + ".rxDoneData", vnic->rxDoneData); } /* diff --git a/src/dev/sinic.hh b/src/dev/sinic.hh index 58f9e7253..ac7af34af 100644 --- a/src/dev/sinic.hh +++ b/src/dev/sinic.hh @@ -73,8 +73,8 @@ class Base : public EtherDevBase * Serialization stuff */ public: - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** * Construction/Destruction/Parameters @@ -297,8 +297,8 @@ class Device : public Base * Serialization stuff */ public: - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serializeOld(CheckpointOut &cp) M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; public: Device(const Params *p); diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc index 3853abb16..5b74bbcb7 100644 --- a/src/dev/sparc/dtod.cc +++ b/src/dev/sparc/dtod.cc @@ -79,13 +79,13 @@ DumbTOD::write(PacketPtr pkt) } void -DumbTOD::serialize(std::ostream &os) +DumbTOD::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(todTime); } void -DumbTOD::unserialize(Checkpoint *cp, const std::string §ion) +DumbTOD::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(todTime); } diff --git a/src/dev/sparc/dtod.hh b/src/dev/sparc/dtod.hh index a5b2dfaff..a7b451364 100644 --- a/src/dev/sparc/dtod.hh +++ b/src/dev/sparc/dtod.hh @@ -63,20 +63,8 @@ class DumbTOD : public BasicPioDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - /** - * 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); - - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __DEV_BADDEV_HH__ diff --git a/src/dev/sparc/iob.cc b/src/dev/sparc/iob.cc index c71edd9f0..bee0323c8 100644 --- a/src/dev/sparc/iob.cc +++ b/src/dev/sparc/iob.cc @@ -334,41 +334,43 @@ Iob::getAddrRanges() const void -Iob::serialize(std::ostream &os) +Iob::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(jIntVec); SERIALIZE_ARRAY(jBusData0, MaxNiagaraProcs); SERIALIZE_ARRAY(jBusData1, MaxNiagaraProcs); for (int x = 0; x < NumDeviceIds; x++) { - nameOut(os, csprintf("%s.Int%d", name(), x)); - paramOut(os, "cpu", intMan[x].cpu); - paramOut(os, "vector", intMan[x].vector); - paramOut(os, "mask", intCtl[x].mask); - paramOut(os, "pend", intCtl[x].pend); + ScopedCheckpointSection sec(cp, csprintf("Int%d", x)); + paramOut(cp, "cpu", intMan[x].cpu); + paramOut(cp, "vector", intMan[x].vector); + paramOut(cp, "mask", intCtl[x].mask); + paramOut(cp, "pend", intCtl[x].pend); }; for (int x = 0; x < MaxNiagaraProcs; x++) { - nameOut(os, csprintf("%s.jIntBusy%d", name(), x)); - paramOut(os, "busy", jIntBusy[x].busy); - paramOut(os, "source", jIntBusy[x].source); + ScopedCheckpointSection sec(cp, csprintf("jIntBusy%d", x)); + paramOut(cp, "busy", jIntBusy[x].busy); + paramOut(cp, "source", jIntBusy[x].source); }; } void -Iob::unserialize(Checkpoint *cp, const std::string §ion) +Iob::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(jIntVec); UNSERIALIZE_ARRAY(jBusData0, MaxNiagaraProcs); UNSERIALIZE_ARRAY(jBusData1, MaxNiagaraProcs); for (int x = 0; x < NumDeviceIds; x++) { - paramIn(cp, csprintf("%s.Int%d", name(), x), "cpu", intMan[x].cpu); - paramIn(cp, csprintf("%s.Int%d", name(), x), "vector", intMan[x].vector); - paramIn(cp, csprintf("%s.Int%d", name(), x), "mask", intCtl[x].mask); - paramIn(cp, csprintf("%s.Int%d", name(), x), "pend", intCtl[x].pend); + ScopedCheckpointSection sec(cp, csprintf("Int%d", x)); + paramIn(cp, "cpu", intMan[x].cpu); + paramIn(cp, "vector", intMan[x].vector); + paramIn(cp, "mask", intCtl[x].mask); + paramIn(cp, "pend", intCtl[x].pend); }; for (int x = 0; x < MaxNiagaraProcs; x++) { - paramIn(cp, csprintf("%s.jIntBusy%d", name(), x), "busy", jIntBusy[x].busy); - paramIn(cp, csprintf("%s.jIntBusy%d", name(), x), "source", jIntBusy[x].source); + ScopedCheckpointSection sec(cp, csprintf("jIntBusy%d", x)); + paramIn(cp, "busy", jIntBusy[x].busy); + paramIn(cp, "source", jIntBusy[x].source); }; } diff --git a/src/dev/sparc/iob.hh b/src/dev/sparc/iob.hh index fc5e61092..033ee3867 100644 --- a/src/dev/sparc/iob.hh +++ b/src/dev/sparc/iob.hh @@ -142,9 +142,8 @@ class Iob : public PioDevice AddrRangeList getAddrRanges() const; - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif //__DEV_SPARC_IOB_HH__ diff --git a/src/dev/sparc/mm_disk.cc b/src/dev/sparc/mm_disk.cc index 0a6d14445..5fe9157bc 100644 --- a/src/dev/sparc/mm_disk.cc +++ b/src/dev/sparc/mm_disk.cc @@ -170,7 +170,7 @@ MmDisk::write(PacketPtr pkt) } void -MmDisk::serialize(std::ostream &os) +MmDisk::serialize(CheckpointOut &cp) const { // just write any dirty changes to the cow layer it will take care of // serialization diff --git a/src/dev/sparc/mm_disk.hh b/src/dev/sparc/mm_disk.hh index d14e1d4a4..2de3cac7d 100644 --- a/src/dev/sparc/mm_disk.hh +++ b/src/dev/sparc/mm_disk.hh @@ -61,7 +61,7 @@ class MmDisk : public BasicPioDevice virtual Tick read(PacketPtr pkt); virtual Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; }; #endif //__DEV_SPARC_MM_DISK_HH__ diff --git a/src/dev/uart8250.cc b/src/dev/uart8250.cc index e840d2a56..a9446e6d5 100644 --- a/src/dev/uart8250.cc +++ b/src/dev/uart8250.cc @@ -292,7 +292,7 @@ Uart8250::getAddrRanges() const } void -Uart8250::serialize(ostream &os) +Uart8250::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(status); SERIALIZE_SCALAR(IER); @@ -314,7 +314,7 @@ Uart8250::serialize(ostream &os) } void -Uart8250::unserialize(Checkpoint *cp, const std::string §ion) +Uart8250::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(status); UNSERIALIZE_SCALAR(IER); diff --git a/src/dev/uart8250.hh b/src/dev/uart8250.hh index 7d577954c..6b255594a 100644 --- a/src/dev/uart8250.hh +++ b/src/dev/uart8250.hh @@ -113,9 +113,8 @@ class Uart8250 : public Uart */ virtual bool intStatus() { return status ? true : false; } - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; #endif // __TSUNAMI_UART_HH__ diff --git a/src/dev/virtio/base.cc b/src/dev/virtio/base.cc index a65fe7fa4..ad97de99c 100644 --- a/src/dev/virtio/base.cc +++ b/src/dev/virtio/base.cc @@ -233,18 +233,18 @@ VirtQueue::VirtQueue(PortProxy &proxy, uint16_t size) } void -VirtQueue::serialize(std::ostream &os) +VirtQueue::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(_address); SERIALIZE_SCALAR(_last_avail); } void -VirtQueue::unserialize(Checkpoint *cp, const std::string §ion) +VirtQueue::unserialize(CheckpointIn &cp) { Addr addr_in; - paramIn(cp, section, "_address", addr_in); + paramIn(cp, "_address", addr_in); UNSERIALIZE_SCALAR(_last_avail); // Use the address setter to ensure that the ring buffer addresses @@ -336,27 +336,23 @@ VirtIODeviceBase::~VirtIODeviceBase() } void -VirtIODeviceBase::serialize(std::ostream &os) +VirtIODeviceBase::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(guestFeatures); - paramOut(os, "_deviceStatus", (uint8_t)_deviceStatus); + SERIALIZE_SCALAR(_deviceStatus); SERIALIZE_SCALAR(_queueSelect); - for (QueueID i = 0; i < _queues.size(); ++i) { - nameOut(os, csprintf("%s._queues.%i", name(), i)); - _queues[i]->serialize(os); - } + for (QueueID i = 0; i < _queues.size(); ++i) + _queues[i]->serializeSection(cp, csprintf("_queues.%i", i)); } void -VirtIODeviceBase::unserialize(Checkpoint *cp, const std::string §ion) +VirtIODeviceBase::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(guestFeatures); - uint8_t status; - paramIn(cp, section, "_deviceStatus", status); - _deviceStatus = status; + UNSERIALIZE_SCALAR(_deviceStatus); UNSERIALIZE_SCALAR(_queueSelect); for (QueueID i = 0; i < _queues.size(); ++i) - _queues[i]->unserialize(cp, csprintf("%s._queues.%i", section, i)); + _queues[i]->unserializeSection(cp, csprintf("_queues.%i", i)); } void diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh index fe1685767..de68f92e1 100644 --- a/src/dev/virtio/base.hh +++ b/src/dev/virtio/base.hh @@ -312,16 +312,15 @@ class VirtDescriptor * @note Queues must be registered with * VirtIODeviceBase::registerQueue() to be active. */ -class VirtQueue { +class VirtQueue : public Serializable { public: virtual ~VirtQueue() {}; /** @{ * @name Checkpointing Interface */ - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); - /** @} */ + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** @{ * @name Low-level Device Interface @@ -596,10 +595,8 @@ class VirtIODeviceBase : public SimObject /** @{ * @name SimObject Interfaces */ - - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; /** @} */ diff --git a/src/dev/virtio/fs9p.cc b/src/dev/virtio/fs9p.cc index 4861821d7..336757bb9 100644 --- a/src/dev/virtio/fs9p.cc +++ b/src/dev/virtio/fs9p.cc @@ -214,13 +214,13 @@ VirtIO9PProxy::~VirtIO9PProxy() void -VirtIO9PProxy::VirtIO9PProxy::serialize(std::ostream &os) +VirtIO9PProxy::VirtIO9PProxy::serialize(CheckpointOut &cp) const { fatal("Can't checkpoint a system with a VirtIO 9p proxy!\n"); } void -VirtIO9PProxy::unserialize(Checkpoint *cp, const std::string §ion) +VirtIO9PProxy::unserialize(CheckpointIn &cp) { fatal("Can't checkpoint a system with a VirtIO 9p proxy!\n"); } diff --git a/src/dev/virtio/fs9p.hh b/src/dev/virtio/fs9p.hh index 2cbdbc9eb..a7fb780aa 100644 --- a/src/dev/virtio/fs9p.hh +++ b/src/dev/virtio/fs9p.hh @@ -216,8 +216,8 @@ class VirtIO9PProxy : public VirtIO9PBase VirtIO9PProxy(Params *params); virtual ~VirtIO9PProxy(); - void serialize(std::ostream &os); - void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; protected: void recvTMsg(const P9MsgHeader &header, const uint8_t *data, size_t size); diff --git a/src/dev/x86/cmos.cc b/src/dev/x86/cmos.cc index 6a778b758..73cfe853e 100644 --- a/src/dev/x86/cmos.cc +++ b/src/dev/x86/cmos.cc @@ -119,23 +119,23 @@ X86ISA::Cmos::startup() } void -X86ISA::Cmos::serialize(std::ostream &os) +X86ISA::Cmos::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(address); SERIALIZE_ARRAY(regs, numRegs); // Serialize the timer - rtc.serialize("rtc", os); + rtc.serialize("rtc", cp); } void -X86ISA::Cmos::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::Cmos::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(address); UNSERIALIZE_ARRAY(regs, numRegs); // Serialize the timer - rtc.unserialize("rtc", cp, section); + rtc.unserialize("rtc", cp); } X86ISA::Cmos * diff --git a/src/dev/x86/cmos.hh b/src/dev/x86/cmos.hh index fa5865c0a..f0234da54 100644 --- a/src/dev/x86/cmos.hh +++ b/src/dev/x86/cmos.hh @@ -83,9 +83,9 @@ class Cmos : public BasicPioDevice Tick write(PacketPtr pkt); virtual void startup(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; } // namespace X86ISA diff --git a/src/dev/x86/i8042.cc b/src/dev/x86/i8042.cc index a0a7c35ec..03b12dc14 100644 --- a/src/dev/x86/i8042.cc +++ b/src/dev/x86/i8042.cc @@ -463,7 +463,7 @@ X86ISA::I8042::write(PacketPtr pkt) } void -X86ISA::I8042::serialize(std::ostream &os) +X86ISA::I8042::serializeOld(CheckpointOut &cp) { uint8_t statusRegData = statusReg.__data; uint8_t commandByteData = commandByte.__data; @@ -474,12 +474,12 @@ X86ISA::I8042::serialize(std::ostream &os) SERIALIZE_SCALAR(commandByteData); SERIALIZE_SCALAR(dataReg); SERIALIZE_SCALAR(lastCommand); - mouse.serialize("mouse", os); - keyboard.serialize("keyboard", os); + mouse.serialize("mouse", cp); + keyboard.serialize("keyboard", cp); } void -X86ISA::I8042::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::I8042::unserialize(CheckpointIn &cp) { uint8_t statusRegData; uint8_t commandByteData; @@ -490,38 +490,37 @@ X86ISA::I8042::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_SCALAR(commandByteData); UNSERIALIZE_SCALAR(dataReg); UNSERIALIZE_SCALAR(lastCommand); - mouse.unserialize("mouse", cp, section); - keyboard.unserialize("keyboard", cp, section); + mouse.unserialize("mouse", cp); + keyboard.unserialize("keyboard", cp); statusReg.__data = statusRegData; commandByte.__data = commandByteData; } void -X86ISA::PS2Keyboard::serialize(const std::string &base, std::ostream &os) +X86ISA::PS2Keyboard::serialize(const std::string &base, CheckpointOut &cp) { - paramOut(os, base + ".lastCommand", lastCommand); + paramOut(cp, base + ".lastCommand", lastCommand); int bufferSize = outBuffer.size(); - paramOut(os, base + ".outBuffer.size", bufferSize); + paramOut(cp, base + ".outBuffer.size", bufferSize); uint8_t *buffer = new uint8_t[bufferSize]; for (int i = 0; i < bufferSize; ++i) { buffer[i] = outBuffer.front(); outBuffer.pop(); } - arrayParamOut(os, base + ".outBuffer.elts", buffer, + arrayParamOut(cp, base + ".outBuffer.elts", buffer, bufferSize*sizeof(uint8_t)); delete[] buffer; } void -X86ISA::PS2Keyboard::unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion) +X86ISA::PS2Keyboard::unserialize(const std::string &base, CheckpointIn &cp) { - paramIn(cp, section, base + ".lastCommand", lastCommand); + paramIn(cp, base + ".lastCommand", lastCommand); int bufferSize; - paramIn(cp, section, base + ".outBuffer.size", bufferSize); + paramIn(cp, base + ".outBuffer.size", bufferSize); uint8_t *buffer = new uint8_t[bufferSize]; - arrayParamIn(cp, section, base + ".outBuffer.elts", buffer, + arrayParamIn(cp, base + ".outBuffer.elts", buffer, bufferSize*sizeof(uint8_t)); for (int i = 0; i < bufferSize; ++i) { outBuffer.push(buffer[i]); @@ -530,43 +529,42 @@ X86ISA::PS2Keyboard::unserialize(const std::string &base, Checkpoint *cp, } void -X86ISA::PS2Mouse::serialize(const std::string &base, std::ostream &os) +X86ISA::PS2Mouse::serialize(const std::string &base, CheckpointOut &cp) { uint8_t statusData = status.__data; - paramOut(os, base + ".lastCommand", lastCommand); + paramOut(cp, base + ".lastCommand", lastCommand); int bufferSize = outBuffer.size(); - paramOut(os, base + ".outBuffer.size", bufferSize); + paramOut(cp, base + ".outBuffer.size", bufferSize); uint8_t *buffer = new uint8_t[bufferSize]; for (int i = 0; i < bufferSize; ++i) { buffer[i] = outBuffer.front(); outBuffer.pop(); } - arrayParamOut(os, base + ".outBuffer.elts", buffer, + arrayParamOut(cp, base + ".outBuffer.elts", buffer, bufferSize*sizeof(uint8_t)); delete[] buffer; - paramOut(os, base + ".status", statusData); - paramOut(os, base + ".resolution", resolution); - paramOut(os, base + ".sampleRate", sampleRate); + paramOut(cp, base + ".status", statusData); + paramOut(cp, base + ".resolution", resolution); + paramOut(cp, base + ".sampleRate", sampleRate); } void -X86ISA::PS2Mouse::unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion) +X86ISA::PS2Mouse::unserialize(const std::string &base, CheckpointIn &cp) { uint8_t statusData; - paramIn(cp, section, base + ".lastCommand", lastCommand); + paramIn(cp, base + ".lastCommand", lastCommand); int bufferSize; - paramIn(cp, section, base + ".outBuffer.size", bufferSize); + paramIn(cp, base + ".outBuffer.size", bufferSize); uint8_t *buffer = new uint8_t[bufferSize]; - arrayParamIn(cp, section, base + ".outBuffer.elts", buffer, + arrayParamIn(cp, base + ".outBuffer.elts", buffer, bufferSize*sizeof(uint8_t)); for (int i = 0; i < bufferSize; ++i) { outBuffer.push(buffer[i]); } delete[] buffer; - paramIn(cp, section, base + ".status", statusData); - paramIn(cp, section, base + ".resolution", resolution); - paramIn(cp, section, base + ".sampleRate", sampleRate); + paramIn(cp, base + ".status", statusData); + paramIn(cp, base + ".resolution", resolution); + paramIn(cp, base + ".sampleRate", sampleRate); status.__data = statusData; } diff --git a/src/dev/x86/i8042.hh b/src/dev/x86/i8042.hh index 791922142..9d2548857 100644 --- a/src/dev/x86/i8042.hh +++ b/src/dev/x86/i8042.hh @@ -117,9 +117,8 @@ class PS2Mouse : public PS2Device bool processData(uint8_t data); - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void serialize(const std::string &base, CheckpointOut &cp); + void unserialize(const std::string &base, CheckpointIn &cp); }; class PS2Keyboard : public PS2Device @@ -151,9 +150,8 @@ class PS2Keyboard : public PS2Device public: bool processData(uint8_t data); - void serialize(const std::string &base, std::ostream &os); - void unserialize(const std::string &base, Checkpoint *cp, - const std::string §ion); + void serialize(const std::string &base, CheckpointOut &cp); + void unserialize(const std::string &base, CheckpointIn &cp); }; class I8042 : public BasicPioDevice @@ -249,8 +247,8 @@ class I8042 : public BasicPioDevice Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serializeOld(CheckpointOut &cp) M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; } // namespace X86ISA diff --git a/src/dev/x86/i82094aa.cc b/src/dev/x86/i82094aa.cc index 12697ce62..44fa29154 100644 --- a/src/dev/x86/i82094aa.cc +++ b/src/dev/x86/i82094aa.cc @@ -260,7 +260,7 @@ X86ISA::I82094AA::lowerInterruptPin(int number) } void -X86ISA::I82094AA::serialize(std::ostream &os) +X86ISA::I82094AA::serialize(CheckpointOut &cp) const { uint64_t* redirTableArray = (uint64_t*)redirTable; SERIALIZE_SCALAR(regSel); @@ -273,7 +273,7 @@ X86ISA::I82094AA::serialize(std::ostream &os) } void -X86ISA::I82094AA::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::I82094AA::unserialize(CheckpointIn &cp) { uint64_t redirTableArray[TableSize]; UNSERIALIZE_SCALAR(regSel); diff --git a/src/dev/x86/i82094aa.hh b/src/dev/x86/i82094aa.hh index 4fe927ae4..afa597e65 100644 --- a/src/dev/x86/i82094aa.hh +++ b/src/dev/x86/i82094aa.hh @@ -109,8 +109,8 @@ class I82094AA : public BasicPioDevice, public IntDevice void raiseInterruptPin(int number); void lowerInterruptPin(int number); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; } // namespace X86ISA diff --git a/src/dev/x86/i8237.cc b/src/dev/x86/i8237.cc index a43c1ec91..b16f78883 100644 --- a/src/dev/x86/i8237.cc +++ b/src/dev/x86/i8237.cc @@ -126,13 +126,13 @@ X86ISA::I8237::write(PacketPtr pkt) } void -X86ISA::I8237::serialize(std::ostream &os) +X86ISA::I8237::serialize(CheckpointOut &cp) const { SERIALIZE_SCALAR(maskReg); } void -X86ISA::I8237::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::I8237::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(maskReg); } diff --git a/src/dev/x86/i8237.hh b/src/dev/x86/i8237.hh index b1b11091b..481983b8e 100644 --- a/src/dev/x86/i8237.hh +++ b/src/dev/x86/i8237.hh @@ -59,8 +59,8 @@ class I8237 : public BasicPioDevice Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; } // namespace X86ISA diff --git a/src/dev/x86/i8254.cc b/src/dev/x86/i8254.cc index b80952237..f784a0107 100644 --- a/src/dev/x86/i8254.cc +++ b/src/dev/x86/i8254.cc @@ -78,15 +78,15 @@ X86ISA::I8254::write(PacketPtr pkt) } void -X86ISA::I8254::serialize(std::ostream &os) +X86ISA::I8254::serialize(CheckpointOut &cp) const { - pit.serialize("pit", os); + pit.serialize("pit", cp); } void -X86ISA::I8254::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::I8254::unserialize(CheckpointIn &cp) { - pit.unserialize("pit", cp, section); + pit.unserialize("pit", cp); } void diff --git a/src/dev/x86/i8254.hh b/src/dev/x86/i8254.hh index 76521e73e..c4f04bd42 100644 --- a/src/dev/x86/i8254.hh +++ b/src/dev/x86/i8254.hh @@ -109,8 +109,9 @@ class I8254 : public BasicPioDevice pit.writeControl(val); } - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; + virtual void startup(); }; diff --git a/src/dev/x86/i8259.cc b/src/dev/x86/i8259.cc index d599ecef3..84f2d1321 100644 --- a/src/dev/x86/i8259.cc +++ b/src/dev/x86/i8259.cc @@ -305,7 +305,7 @@ X86ISA::I8259::getVector() } void -X86ISA::I8259::serialize(std::ostream &os) +X86ISA::I8259::serialize(CheckpointOut &cp) const { SERIALIZE_ARRAY(pinStates, NumLines); SERIALIZE_ENUM(mode); @@ -323,7 +323,7 @@ X86ISA::I8259::serialize(std::ostream &os) } void -X86ISA::I8259::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::I8259::unserialize(CheckpointIn &cp) { UNSERIALIZE_ARRAY(pinStates, NumLines); UNSERIALIZE_ENUM(mode); diff --git a/src/dev/x86/i8259.hh b/src/dev/x86/i8259.hh index 2d6080cc3..567ad7a32 100644 --- a/src/dev/x86/i8259.hh +++ b/src/dev/x86/i8259.hh @@ -109,8 +109,8 @@ class I8259 : public BasicPioDevice, public IntDevice void lowerInterruptPin(int number); int getVector(); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; } // namespace X86ISA diff --git a/src/dev/x86/speaker.cc b/src/dev/x86/speaker.cc index 70f52dd1a..235860815 100644 --- a/src/dev/x86/speaker.cc +++ b/src/dev/x86/speaker.cc @@ -74,14 +74,14 @@ X86ISA::Speaker::write(PacketPtr pkt) } void -X86ISA::Speaker::serialize(std::ostream &os) +X86ISA::Speaker::serialize(CheckpointOut &cp) const { uint8_t controlValData = controlVal.__data; SERIALIZE_SCALAR(controlValData); } void -X86ISA::Speaker::unserialize(Checkpoint *cp, const std::string §ion) +X86ISA::Speaker::unserialize(CheckpointIn &cp) { uint8_t controlValData; UNSERIALIZE_SCALAR(controlValData); diff --git a/src/dev/x86/speaker.hh b/src/dev/x86/speaker.hh index 22fc03e1c..3c879060f 100644 --- a/src/dev/x86/speaker.hh +++ b/src/dev/x86/speaker.hh @@ -73,9 +73,8 @@ class Speaker : public BasicPioDevice Tick write(PacketPtr pkt); - virtual void serialize(std::ostream &os); - virtual void unserialize(Checkpoint *cp, const std::string §ion); - + void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE; + void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE; }; } // namespace X86ISA |