qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [4767] Add VM save/load support
@ 2008-06-21 17:14 malc
  0 siblings, 0 replies; only message in thread
From: malc @ 2008-06-21 17:14 UTC (permalink / raw)
  To: qemu-devel

Revision: 4767
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4767
Author:   malc
Date:     2008-06-21 17:14:54 +0000 (Sat, 21 Jun 2008)

Log Message:
-----------
Add VM save/load support

Modified Paths:
--------------
    trunk/hw/gus.c

Modified: trunk/hw/gus.c
===================================================================
--- trunk/hw/gus.c	2008-06-21 17:14:50 UTC (rev 4766)
+++ trunk/hw/gus.c	2008-06-21 17:14:54 UTC (rev 4767)
@@ -220,6 +220,40 @@
     return dma_len;
 }
 
+static void GUS_save (QEMUFile *f, void *opaque)
+{
+    int32_t val;
+    GUSState *s = opaque;
+
+    val = s->freq;    qemu_put_be32s (f, &val);
+    val = s->pos;     qemu_put_be32s (f, &val);
+    val = s->left;    qemu_put_be32s (f, &val);
+    val = s->shift;   qemu_put_be32s (f, &val);
+    val = s->irqs;    qemu_put_be32s (f, &val);
+    val = s->samples; qemu_put_be32s (f, &val);
+    qemu_put_be64s (f, &s->last_ticks);
+    qemu_put_buffer (f, s->himem, sizeof (s->himem));
+}
+
+static int GUS_load (QEMUFile *f, void *opaque, int version_id)
+{
+    int32_t val;
+    GUSState *s = opaque;
+
+    if (version_id != 1)
+        return -EINVAL;
+
+    qemu_get_be32s (f, &val); s->freq = val;
+    qemu_get_be32s (f, &val); s->pos = val;
+    qemu_get_be32s (f, &val); s->left = val;
+    qemu_get_be32s (f, &val); s->shift = val;
+    qemu_get_be32s (f, &val); s->irqs = val;
+    qemu_get_be32s (f, &val); s->samples = val;
+    qemu_get_be64s (f, &s->last_ticks);
+    qemu_get_buffer (f, s->himem, sizeof (s->himem));
+    return 0;
+}
+
 int GUS_init (AudioState *audio, qemu_irq *pic)
 {
     GUSState *s;
@@ -296,5 +330,7 @@
     s->pic = pic;
 
     AUD_set_active_out (s->voice, 1);
+
+    register_savevm ("gus", 0, 1, GUS_save, GUS_load, s);
     return 0;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-21 17:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21 17:14 [Qemu-devel] [4767] Add VM save/load support malc

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).