Commit 7783e9f0029819101e206d7baf6db445e6e4692f
1 parent
33698e5f
Keyboard savevm fix (malc).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1797 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
39 additions
and
15 deletions
hw/pckbd.c
... | ... | @@ -118,7 +118,7 @@ typedef struct KBDState { |
118 | 118 | uint8_t status; |
119 | 119 | uint8_t mode; |
120 | 120 | /* Bitmask of devices with data available. */ |
121 | - int pending; | |
121 | + uint8_t pending; | |
122 | 122 | void *kbd; |
123 | 123 | void *mouse; |
124 | 124 | } KBDState; |
... | ... | @@ -337,17 +337,19 @@ static void kbd_save(QEMUFile* f, void* opaque) |
337 | 337 | qemu_put_8s(f, &s->write_cmd); |
338 | 338 | qemu_put_8s(f, &s->status); |
339 | 339 | qemu_put_8s(f, &s->mode); |
340 | + qemu_put_8s(f, &s->pending); | |
340 | 341 | } |
341 | 342 | |
342 | 343 | static int kbd_load(QEMUFile* f, void* opaque, int version_id) |
343 | 344 | { |
344 | 345 | KBDState *s = (KBDState*)opaque; |
345 | 346 | |
346 | - if (version_id != 2) | |
347 | + if (version_id != 3) | |
347 | 348 | return -EINVAL; |
348 | 349 | qemu_get_8s(f, &s->write_cmd); |
349 | 350 | qemu_get_8s(f, &s->status); |
350 | 351 | qemu_get_8s(f, &s->mode); |
352 | + qemu_get_8s(f, &s->pending); | |
351 | 353 | return 0; |
352 | 354 | } |
353 | 355 | |
... | ... | @@ -356,7 +358,7 @@ void kbd_init(void) |
356 | 358 | KBDState *s = &kbd_state; |
357 | 359 | |
358 | 360 | kbd_reset(s); |
359 | - register_savevm("pckbd", 0, 2, kbd_save, kbd_load, s); | |
361 | + register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s); | |
360 | 362 | register_ioport_read(0x60, 1, 1, kbd_read_data, s); |
361 | 363 | register_ioport_write(0x60, 1, 1, kbd_write_data, s); |
362 | 364 | register_ioport_read(0x64, 1, 1, kbd_read_status, s); | ... | ... |
hw/ps2.c
... | ... | @@ -461,19 +461,38 @@ static void ps2_reset(void *opaque) |
461 | 461 | q->count = 0; |
462 | 462 | } |
463 | 463 | |
464 | +static void ps2_common_save (QEMUFile *f, PS2State *s) | |
465 | +{ | |
466 | + qemu_put_be32s (f, &s->write_cmd); | |
467 | + qemu_put_be32s (f, &s->queue.rptr); | |
468 | + qemu_put_be32s (f, &s->queue.wptr); | |
469 | + qemu_put_be32s (f, &s->queue.count); | |
470 | + qemu_put_buffer (f, s->queue.data, sizeof (s->queue.data)); | |
471 | +} | |
472 | + | |
473 | +static void ps2_common_load (QEMUFile *f, PS2State *s) | |
474 | +{ | |
475 | + qemu_get_be32s (f, &s->write_cmd); | |
476 | + qemu_get_be32s (f, &s->queue.rptr); | |
477 | + qemu_get_be32s (f, &s->queue.wptr); | |
478 | + qemu_get_be32s (f, &s->queue.count); | |
479 | + qemu_get_buffer (f, s->queue.data, sizeof (s->queue.data)); | |
480 | +} | |
481 | + | |
464 | 482 | static void ps2_kbd_save(QEMUFile* f, void* opaque) |
465 | 483 | { |
466 | 484 | PS2KbdState *s = (PS2KbdState*)opaque; |
467 | - | |
468 | - qemu_put_be32s(f, &s->common.write_cmd); | |
485 | + | |
486 | + ps2_common_save (f, &s->common); | |
469 | 487 | qemu_put_be32s(f, &s->scan_enabled); |
488 | + qemu_put_be32s(f, &s->translate); | |
470 | 489 | } |
471 | 490 | |
472 | 491 | static void ps2_mouse_save(QEMUFile* f, void* opaque) |
473 | 492 | { |
474 | 493 | PS2MouseState *s = (PS2MouseState*)opaque; |
475 | - | |
476 | - qemu_put_be32s(f, &s->common.write_cmd); | |
494 | + | |
495 | + ps2_common_save (f, &s->common); | |
477 | 496 | qemu_put_8s(f, &s->mouse_status); |
478 | 497 | qemu_put_8s(f, &s->mouse_resolution); |
479 | 498 | qemu_put_8s(f, &s->mouse_sample_rate); |
... | ... | @@ -489,21 +508,24 @@ static void ps2_mouse_save(QEMUFile* f, void* opaque) |
489 | 508 | static int ps2_kbd_load(QEMUFile* f, void* opaque, int version_id) |
490 | 509 | { |
491 | 510 | PS2KbdState *s = (PS2KbdState*)opaque; |
492 | - | |
493 | - if (version_id != 1) | |
511 | + | |
512 | + if (version_id != 2) | |
494 | 513 | return -EINVAL; |
495 | - qemu_get_be32s(f, &s->common.write_cmd); | |
514 | + | |
515 | + ps2_common_load (f, &s->common); | |
496 | 516 | qemu_get_be32s(f, &s->scan_enabled); |
517 | + qemu_get_be32s(f, &s->translate); | |
497 | 518 | return 0; |
498 | 519 | } |
499 | 520 | |
500 | 521 | static int ps2_mouse_load(QEMUFile* f, void* opaque, int version_id) |
501 | 522 | { |
502 | 523 | PS2MouseState *s = (PS2MouseState*)opaque; |
503 | - | |
504 | - if (version_id != 1) | |
524 | + | |
525 | + if (version_id != 2) | |
505 | 526 | return -EINVAL; |
506 | - qemu_get_be32s(f, &s->common.write_cmd); | |
527 | + | |
528 | + ps2_common_load (f, &s->common); | |
507 | 529 | qemu_get_8s(f, &s->mouse_status); |
508 | 530 | qemu_get_8s(f, &s->mouse_resolution); |
509 | 531 | qemu_get_8s(f, &s->mouse_sample_rate); |
... | ... | @@ -524,7 +546,7 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) |
524 | 546 | s->common.update_irq = update_irq; |
525 | 547 | s->common.update_arg = update_arg; |
526 | 548 | ps2_reset(&s->common); |
527 | - register_savevm("ps2kbd", 0, 1, ps2_kbd_save, ps2_kbd_load, s); | |
549 | + register_savevm("ps2kbd", 0, 2, ps2_kbd_save, ps2_kbd_load, s); | |
528 | 550 | qemu_add_kbd_event_handler(ps2_put_keycode, s); |
529 | 551 | qemu_register_reset(ps2_reset, &s->common); |
530 | 552 | return s; |
... | ... | @@ -537,7 +559,7 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) |
537 | 559 | s->common.update_irq = update_irq; |
538 | 560 | s->common.update_arg = update_arg; |
539 | 561 | ps2_reset(&s->common); |
540 | - register_savevm("ps2mouse", 0, 1, ps2_mouse_save, ps2_mouse_load, s); | |
562 | + register_savevm("ps2mouse", 0, 2, ps2_mouse_save, ps2_mouse_load, s); | |
541 | 563 | qemu_add_mouse_event_handler(ps2_mouse_event, s); |
542 | 564 | qemu_register_reset(ps2_reset, &s->common); |
543 | 565 | return s; | ... | ... |