ia64/xen-unstable

changeset 17667:13e10678e714

ioemu: serial save/load fix

This patch fixes several bugs in serial.c
(1) A typo in serial_save() where qemu_get_8s is called (should be
qemu_put_8s)
(2) No support provided in serial_load() for version_id == 1 (should
unmarshal a 1 byte s->divider and should provide a default value
for s->fcr)
(3) Call serial_ioport_write() to initialize s->fcr. It is not
sufficient to load its value; other hidden values (such as
s->recv_fifo.itl) must be re-initialized.

Signed-off-by: Ben Guthro <bguthro@virtualiron.com>
Signed-off-by: Robert Phillips <rphillips@virtualiron.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri May 16 09:30:10 2008 +0100 (2008-05-16)
parents f12724194ec6
children f65906f262f9
files tools/ioemu/hw/serial.c
line diff
     1.1 --- a/tools/ioemu/hw/serial.c	Thu May 15 16:40:51 2008 +0100
     1.2 +++ b/tools/ioemu/hw/serial.c	Fri May 16 09:30:10 2008 +0100
     1.3 @@ -705,12 +705,13 @@ static void serial_save(QEMUFile *f, voi
     1.4      qemu_put_8s(f,&s->lsr);
     1.5      qemu_put_8s(f,&s->msr);
     1.6      qemu_put_8s(f,&s->scr);
     1.7 -    qemu_get_8s(f,&s->fcr);
     1.8 +    qemu_put_8s(f,&s->fcr);
     1.9  }
    1.10  
    1.11  static int serial_load(QEMUFile *f, void *opaque, int version_id)
    1.12  {
    1.13      SerialState *s = opaque;
    1.14 +    uint8_t fcr = 0;
    1.15  
    1.16      if(version_id > 2)
    1.17          return -EINVAL;
    1.18 @@ -729,6 +730,11 @@ static int serial_load(QEMUFile *f, void
    1.19      qemu_get_8s(f,&s->scr);
    1.20      qemu_get_8s(f,&s->fcr);
    1.21  
    1.22 +    if (version_id >= 2)
    1.23 +        qemu_get_8s(f,&fcr);
    1.24 +
    1.25 +    /* Initialize fcr via setter to perform essential side-effects */
    1.26 +    serial_ioport_write(s, 0x02, fcr);
    1.27      return 0;
    1.28  }
    1.29