[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/26] vmstate: port vmmouse device
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 19/26] vmstate: port vmmouse device |
Date: |
Thu, 10 Sep 2009 03:04:40 +0200 |
Signed-off-by: Juan Quintela <address@hidden>
---
hw/vmmouse.c | 48 ++++++++++++++++++++----------------------------
1 files changed, 20 insertions(+), 28 deletions(-)
diff --git a/hw/vmmouse.c b/hw/vmmouse.c
index c70e825..c207bb2 100644
--- a/hw/vmmouse.c
+++ b/hw/vmmouse.c
@@ -53,6 +53,7 @@
typedef struct _VMMouseState
{
uint32_t queue[VMMOUSE_QUEUE_SIZE];
+ int32_t queue_size;
uint16_t nb_queue;
uint16_t status;
uint8_t absolute;
@@ -234,40 +235,30 @@ static uint32_t vmmouse_ioport_read(void *opaque,
uint32_t addr)
return data[0];
}
-static void vmmouse_save(QEMUFile *f, void *opaque)
+static int vmmouse_post_load(void *opaque)
{
VMMouseState *s = opaque;
- int i;
-
- qemu_put_be32(f, VMMOUSE_QUEUE_SIZE);
- for (i = 0; i < VMMOUSE_QUEUE_SIZE; i++)
- qemu_put_be32s(f, &s->queue[i]);
- qemu_put_be16s(f, &s->nb_queue);
- qemu_put_be16s(f, &s->status);
- qemu_put_8s(f, &s->absolute);
-}
-
-static int vmmouse_load(QEMUFile *f, void *opaque, int version_id)
-{
- VMMouseState *s = opaque;
- int i;
-
- if (version_id != 0)
- return -EINVAL;
-
- if (qemu_get_be32(f) != VMMOUSE_QUEUE_SIZE)
- return -EINVAL;
- for (i = 0; i < VMMOUSE_QUEUE_SIZE; i++)
- qemu_get_be32s(f, &s->queue[i]);
- qemu_get_be16s(f, &s->nb_queue);
- qemu_get_be16s(f, &s->status);
- qemu_get_8s(f, &s->absolute);
vmmouse_update_handler(s);
-
return 0;
}
+static const VMStateDescription vmstate_vmmouse = {
+ .name = "vmmouse",
+ .version_id = 0,
+ .minimum_version_id = 0,
+ .minimum_version_id_old = 0,
+ .post_load = vmmouse_post_load,
+ .fields = (VMStateField []) {
+ VMSTATE_INT32_EQUAL(queue_size, VMMouseState),
+ VMSTATE_UINT32_ARRAY(queue, VMMouseState, VMMOUSE_QUEUE_SIZE),
+ VMSTATE_UINT16(nb_queue, VMMouseState),
+ VMSTATE_UINT16(status, VMMouseState),
+ VMSTATE_UINT8(absolute, VMMouseState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
void *vmmouse_init(void *m)
{
VMMouseState *s = NULL;
@@ -278,11 +269,12 @@ void *vmmouse_init(void *m)
s->status = 0xffff;
s->ps2_mouse = m;
+ s->queue_size = VMMOUSE_QUEUE_SIZE;
vmport_register(VMMOUSE_STATUS, vmmouse_ioport_read, s);
vmport_register(VMMOUSE_COMMAND, vmmouse_ioport_read, s);
vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s);
- register_savevm("vmmouse", 0, 0, vmmouse_save, vmmouse_load, s);
+ vmstate_register(0, &vmstate_vmmouse, s);
return s;
}
--
1.6.2.5
- [Qemu-devel] [PATCH 09/26] vmstate: rename run_after_load() -> post_load(), (continued)
- [Qemu-devel] [PATCH 09/26] vmstate: rename run_after_load() -> post_load(), Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 10/26] vmstate: Add pre_load() hook, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 11/26] vmstate: Add pre/post_save() hooks, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 12/26] vmstate: port cpu_comon, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 14/26] vmstate: port i8259 device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 13/26] vmstate: port fw_cfg device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 15/26] vmstate: add support for uint8_t equal, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 17/26] vmstate: add support for arrays of uint16_t, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 16/26] vmstate: port fdc device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 18/26] vmstate: port dma device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 19/26] vmstate: port vmmouse device,
Juan Quintela <=
- [Qemu-devel] [PATCH 20/26] vmstate: port pckbd device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 21/26] vmstate: add uint64 array support, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 22/26] vmstate: port ioapic device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 24/26] vmstate: port hpet device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 23/26] hpet: it is imposible that qemu_timer field is NULL at this point, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 25/26] vmstate: port serial device, Juan Quintela, 2009/09/09
- [Qemu-devel] [PATCH 26/26] vmstate: port cirrus_vga device, Juan Quintela, 2009/09/09