aboutsummaryrefslogtreecommitdiff
path: root/hw/adb.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
commit9b64997f464bcef06739e9c81a927bf48c375255 (patch)
tree1802fa7d6d89fc071e4e9101eb3b4d832a230035 /hw/adb.c
parentac0df51d7b3e0a76923a03efa2cfdec4b9f65ef5 (diff)
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/adb.c')
-rw-r--r--hw/adb.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/hw/adb.c b/hw/adb.c
index 0f21445757..61a3cdf210 100644
--- a/hw/adb.c
+++ b/hw/adb.c
@@ -262,6 +262,31 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
return olen;
}
+static void adb_kbd_save(QEMUFile *f, void *opaque)
+{
+ KBDState *s = (KBDState *)opaque;
+
+ qemu_put_buffer(f, s->data, sizeof(s->data));
+ qemu_put_sbe32s(f, &s->rptr);
+ qemu_put_sbe32s(f, &s->wptr);
+ qemu_put_sbe32s(f, &s->count);
+}
+
+static int adb_kbd_load(QEMUFile *f, void *opaque, int version_id)
+{
+ KBDState *s = (KBDState *)opaque;
+
+ if (version_id != 1)
+ return -EINVAL;
+
+ qemu_get_buffer(f, s->data, sizeof(s->data));
+ qemu_get_sbe32s(f, &s->rptr);
+ qemu_get_sbe32s(f, &s->wptr);
+ qemu_get_sbe32s(f, &s->count);
+
+ return 0;
+}
+
static int adb_kbd_reset(ADBDevice *d)
{
KBDState *s = d->opaque;
@@ -281,6 +306,8 @@ void adb_kbd_init(ADBBusState *bus)
d = adb_register_device(bus, ADB_KEYBOARD, adb_kbd_request,
adb_kbd_reset, s);
qemu_add_kbd_event_handler(adb_kbd_put_keycode, d);
+ register_savevm("adb_kbd", -1, 1, adb_kbd_save,
+ adb_kbd_load, s);
}
/***************************************************************/
@@ -413,6 +440,33 @@ static int adb_mouse_reset(ADBDevice *d)
return 0;
}
+static void adb_mouse_save(QEMUFile *f, void *opaque)
+{
+ MouseState *s = (MouseState *)opaque;
+
+ qemu_put_sbe32s(f, &s->buttons_state);
+ qemu_put_sbe32s(f, &s->last_buttons_state);
+ qemu_put_sbe32s(f, &s->dx);
+ qemu_put_sbe32s(f, &s->dy);
+ qemu_put_sbe32s(f, &s->dz);
+}
+
+static int adb_mouse_load(QEMUFile *f, void *opaque, int version_id)
+{
+ MouseState *s = (MouseState *)opaque;
+
+ if (version_id != 1)
+ return -EINVAL;
+
+ qemu_get_sbe32s(f, &s->buttons_state);
+ qemu_get_sbe32s(f, &s->last_buttons_state);
+ qemu_get_sbe32s(f, &s->dx);
+ qemu_get_sbe32s(f, &s->dy);
+ qemu_get_sbe32s(f, &s->dz);
+
+ return 0;
+}
+
void adb_mouse_init(ADBBusState *bus)
{
ADBDevice *d;
@@ -422,4 +476,6 @@ void adb_mouse_init(ADBBusState *bus)
d = adb_register_device(bus, ADB_MOUSE, adb_mouse_request,
adb_mouse_reset, s);
qemu_add_mouse_event_handler(adb_mouse_event, d, 0, "QEMU ADB Mouse");
+ register_savevm("adb_mouse", -1, 1, adb_mouse_save,
+ adb_mouse_load, s);
}