diff options
Diffstat (limited to 'src/dev/virtio')
-rw-r--r-- | src/dev/virtio/base.cc | 24 | ||||
-rw-r--r-- | src/dev/virtio/base.hh | 13 | ||||
-rw-r--r-- | src/dev/virtio/fs9p.cc | 4 | ||||
-rw-r--r-- | src/dev/virtio/fs9p.hh | 4 |
4 files changed, 19 insertions, 26 deletions
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); |