qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Save/load PC speaker internal state (v2)
@ 2012-08-28  6:58 Pavel Dovgaluk
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Dovgaluk @ 2012-08-28  6:58 UTC (permalink / raw)
  To: 'qemu-devel'

Save PC speaker state to remove differences between system
states after saving the snapshot and after loading it again.
This patch is needed for deterministic replay of the execution.

v2: Do not save the data that cannot affect the guest code behavior.

Signed-off-by: Pavel Dovgalyuk<pavel.dovgaluk@gmail.com>
---
 hw/pcspk.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/hw/pcspk.c b/hw/pcspk.c
index e430324..07a3de0 100644
--- a/hw/pcspk.c
+++ b/hw/pcspk.c
@@ -46,8 +46,8 @@ typedef struct {
     unsigned int pit_count;
     unsigned int samples;
     unsigned int play_pos;
-    int data_on;
-    int dummy_refresh_clock;
+    uint8_t data_on;
+    uint8_t dummy_refresh_clock;
 } PCSpkState;
 
 static const char *s_spk = "pcspk";
@@ -159,6 +159,18 @@ static const MemoryRegionOps pcspk_io_ops = {
     },
 };
 
+static const VMStateDescription vmstate_spk = {
+    .name = "pcspk",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_UINT8(data_on, PCSpkState),
+        VMSTATE_UINT8(dummy_refresh_clock, PCSpkState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int pcspk_initfn(ISADevice *dev)
 {
     PCSpkState *s = DO_UPCAST(PCSpkState, dev, dev);
@@ -185,6 +197,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data)
     ic->init = pcspk_initfn;
     dc->no_user = 1;
     dc->props = pcspk_properties;
+    dc->vmsd = &vmstate_spk;
 }
 
 static TypeInfo pcspk_info = {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-29  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <48961.0236989849$1346137146@news.gmane.org>
2012-08-28  7:12 ` [Qemu-devel] [PATCH] Save/load PC speaker internal state (v2) Jan Kiszka
2012-08-29  7:05   ` Pavel Dovgaluk
2012-08-29  8:57     ` Jan Kiszka
2012-08-28  6:58 Pavel Dovgaluk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).