summaryrefslogtreecommitdiff
path: root/hw/mac_nvram.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-30 19:01:19 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-30 19:01:19 +0000
commit37477fa80b4afdc277425c8ddd91e3c1c2551312 (patch)
tree1802fa7d6d89fc071e4e9101eb3b4d832a230035 /hw/mac_nvram.c
parent91a205681d7536b691c06f3757e02620be9150b6 (diff)
downloadqemu-37477fa80b4afdc277425c8ddd91e3c1c2551312.tar.gz
qemu-37477fa80b4afdc277425c8ddd91e3c1c2551312.tar.bz2
qemu-37477fa80b4afdc277425c8ddd91e3c1c2551312.zip
VM load/save support for PPC devices
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6142 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/mac_nvram.c')
-rw-r--r--hw/mac_nvram.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/mac_nvram.c b/hw/mac_nvram.c
index c1281c33df..2c900614cd 100644
--- a/hw/mac_nvram.c
+++ b/hw/mac_nvram.c
@@ -104,6 +104,25 @@ static CPUReadMemoryFunc *nvram_read[] = {
&macio_nvram_readb,
};
+static void macio_nvram_save(QEMUFile *f, void *opaque)
+{
+ MacIONVRAMState *s = (MacIONVRAMState *)opaque;
+
+ qemu_put_buffer(f, s->data, s->size);
+}
+
+static int macio_nvram_load(QEMUFile *f, void *opaque, int version_id)
+{
+ MacIONVRAMState *s = (MacIONVRAMState *)opaque;
+
+ if (version_id != 1)
+ return -EINVAL;
+
+ qemu_get_buffer(f, s->data, s->size);
+
+ return 0;
+}
+
static void macio_nvram_reset(void *opaque)
{
}
@@ -124,6 +143,8 @@ MacIONVRAMState *macio_nvram_init (int *mem_index, target_phys_addr_t size)
s->mem_index = cpu_register_io_memory(0, nvram_read, nvram_write, s);
*mem_index = s->mem_index;
+ register_savevm("macio_nvram", -1, 1, macio_nvram_save, macio_nvram_load,
+ s);
qemu_register_reset(macio_nvram_reset, s);
macio_nvram_reset(s);