qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] serial save load fix
@ 2008-05-15 17:01 Ben Guthro
  2008-05-17 18:36 ` andrzej zaborowski
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Guthro @ 2008-05-15 17:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Robert Phillips

[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

This patch fixes several bugs in serial.c
(1) 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
(2) 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 
<mailto:bguthro@virtualiron.com>>
Signed-off-by: Robert Phillips <rphillips@virtualiron.com 
<mailto:rphillips@virtualiron.com>>

diff -urp nightly-qemu/hw/serial.c nightly-qemu.mod/hw/serial.c
--- nightly-qemu/hw/serial.c    2008-03-25 18:28:25.000000000 -0400
+++ nightly-qemu.mod/hw/serial.c    2008-05-15 11:42:49.000000000 -0400
@@ -338,6 +338,7 @@ static void serial_save(QEMUFile *f, voi
static int serial_load(QEMUFile *f, void *opaque, int version_id)
{
   SerialState *s = opaque;
+    uint8_t fcr;

   if(version_id > 2)
       return -EINVAL;
@@ -354,6 +355,13 @@ static int serial_load(QEMUFile *f, void
   qemu_get_8s(f,&s->lsr);
   qemu_get_8s(f,&s->msr);
   qemu_get_8s(f,&s->scr);
+    if (version_id >= 2)
+        qemu_get_8s(f,&fcr);
+    else
+        fcr = 0; // disable fifos
+
+    /* Initialize fcr via setter to perform essential side-effects */
+    serial_ioport_write(s, 0x02, fcr);

   return 0;
}

[-- Attachment #2: Type: text/html, Size: 1920 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] serial save load fix
  2008-05-15 17:01 [Qemu-devel] [PATCH] serial save load fix Ben Guthro
@ 2008-05-17 18:36 ` andrzej zaborowski
  2008-05-17 18:37   ` andrzej zaborowski
  0 siblings, 1 reply; 3+ messages in thread
From: andrzej zaborowski @ 2008-05-17 18:36 UTC (permalink / raw)
  To: Ben Guthro; +Cc: Robert Phillips, qemu-devel

On 15/05/2008, Ben Guthro <bguthro@virtualiron.com> wrote:
>  This patch fixes several bugs in serial.c
>  (1) 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
>  (2) 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.

The patch does apply (other than it has to be de-HTML-ised) but
version 2 of serial_load doesn't save the FCR, at least in the SVN
tree, http://svn.savannah.gnu.org/viewvc/trunk/hw/serial.c?revision=4336&root=qemu&view=markup

Please check.

Cheers
-- 
Please do not print this email unless absolutely necessary. Spread
environmental awareness.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] serial save load fix
  2008-05-17 18:36 ` andrzej zaborowski
@ 2008-05-17 18:37   ` andrzej zaborowski
  0 siblings, 0 replies; 3+ messages in thread
From: andrzej zaborowski @ 2008-05-17 18:37 UTC (permalink / raw)
  To: Ben Guthro; +Cc: Robert Phillips, qemu-devel

On 17/05/2008, andrzej zaborowski <balrogg@gmail.com> wrote:
> On 15/05/2008, Ben Guthro <bguthro@virtualiron.com> wrote:
>  >  This patch fixes several bugs in serial.c
>  >  (1) 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
>  >  (2) 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.
>
>
> The patch does apply (other than it has to be de-HTML-ised) but
>  version 2 of serial_load doesn't save the FCR, at least in the SVN

Err, of serial_save.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-17 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15 17:01 [Qemu-devel] [PATCH] serial save load fix Ben Guthro
2008-05-17 18:36 ` andrzej zaborowski
2008-05-17 18:37   ` andrzej zaborowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).