aboutsummaryrefslogtreecommitdiff
path: root/hw/ps2.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-04-08 14:12:31 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-04-08 14:12:31 +0000
commit7783e9f0029819101e206d7baf6db445e6e4692f (patch)
tree174415d096ce20ce0baed45df5bb47c19fdefd82 /hw/ps2.c
parent33698e5ffce099286b7788a63142f603b4cd7f38 (diff)
downloadqemu-7783e9f0029819101e206d7baf6db445e6e4692f.zip
qemu-7783e9f0029819101e206d7baf6db445e6e4692f.tar.gz
qemu-7783e9f0029819101e206d7baf6db445e6e4692f.tar.bz2
Keyboard savevm fix (malc).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1797 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ps2.c')
-rw-r--r--hw/ps2.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/hw/ps2.c b/hw/ps2.c
index be6b31c..40be044 100644
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -461,19 +461,38 @@ static void ps2_reset(void *opaque)
q->count = 0;
}
+static void ps2_common_save (QEMUFile *f, PS2State *s)
+{
+ qemu_put_be32s (f, &s->write_cmd);
+ qemu_put_be32s (f, &s->queue.rptr);
+ qemu_put_be32s (f, &s->queue.wptr);
+ qemu_put_be32s (f, &s->queue.count);
+ qemu_put_buffer (f, s->queue.data, sizeof (s->queue.data));
+}
+
+static void ps2_common_load (QEMUFile *f, PS2State *s)
+{
+ qemu_get_be32s (f, &s->write_cmd);
+ qemu_get_be32s (f, &s->queue.rptr);
+ qemu_get_be32s (f, &s->queue.wptr);
+ qemu_get_be32s (f, &s->queue.count);
+ qemu_get_buffer (f, s->queue.data, sizeof (s->queue.data));
+}
+
static void ps2_kbd_save(QEMUFile* f, void* opaque)
{
PS2KbdState *s = (PS2KbdState*)opaque;
-
- qemu_put_be32s(f, &s->common.write_cmd);
+
+ ps2_common_save (f, &s->common);
qemu_put_be32s(f, &s->scan_enabled);
+ qemu_put_be32s(f, &s->translate);
}
static void ps2_mouse_save(QEMUFile* f, void* opaque)
{
PS2MouseState *s = (PS2MouseState*)opaque;
-
- qemu_put_be32s(f, &s->common.write_cmd);
+
+ ps2_common_save (f, &s->common);
qemu_put_8s(f, &s->mouse_status);
qemu_put_8s(f, &s->mouse_resolution);
qemu_put_8s(f, &s->mouse_sample_rate);
@@ -489,21 +508,24 @@ static void ps2_mouse_save(QEMUFile* f, void* opaque)
static int ps2_kbd_load(QEMUFile* f, void* opaque, int version_id)
{
PS2KbdState *s = (PS2KbdState*)opaque;
-
- if (version_id != 1)
+
+ if (version_id != 2)
return -EINVAL;
- qemu_get_be32s(f, &s->common.write_cmd);
+
+ ps2_common_load (f, &s->common);
qemu_get_be32s(f, &s->scan_enabled);
+ qemu_get_be32s(f, &s->translate);
return 0;
}
static int ps2_mouse_load(QEMUFile* f, void* opaque, int version_id)
{
PS2MouseState *s = (PS2MouseState*)opaque;
-
- if (version_id != 1)
+
+ if (version_id != 2)
return -EINVAL;
- qemu_get_be32s(f, &s->common.write_cmd);
+
+ ps2_common_load (f, &s->common);
qemu_get_8s(f, &s->mouse_status);
qemu_get_8s(f, &s->mouse_resolution);
qemu_get_8s(f, &s->mouse_sample_rate);
@@ -524,7 +546,7 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)
s->common.update_irq = update_irq;
s->common.update_arg = update_arg;
ps2_reset(&s->common);
- register_savevm("ps2kbd", 0, 1, ps2_kbd_save, ps2_kbd_load, s);
+ register_savevm("ps2kbd", 0, 2, ps2_kbd_save, ps2_kbd_load, s);
qemu_add_kbd_event_handler(ps2_put_keycode, s);
qemu_register_reset(ps2_reset, &s->common);
return s;
@@ -537,7 +559,7 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)
s->common.update_irq = update_irq;
s->common.update_arg = update_arg;
ps2_reset(&s->common);
- register_savevm("ps2mouse", 0, 1, ps2_mouse_save, ps2_mouse_load, s);
+ register_savevm("ps2mouse", 0, 2, ps2_mouse_save, ps2_mouse_load, s);
qemu_add_mouse_event_handler(ps2_mouse_event, s);
qemu_register_reset(ps2_reset, &s->common);
return s;