From: Ben Guthro <bguthro@virtualiron.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: Robert Phillips <rphillips@virtualiron.com>
Subject: [PATCH][QEMU] serial save load fix
Date: Thu, 15 May 2008 13:01:32 -0400 [thread overview]
Message-ID: <482C6C6C.5070206@virtualiron.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1580 bytes --]
NOTE: An applicable subset of this patch was also submitted to upstream
qemu.
SUMMARY:
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
<mailto:bguthro@virtualiron.com>>
Signed-off-by: Robert Phillips <rphillips@virtualiron.com
<mailto:rphillips@virtualiron.com>>
diff -r a81184e1f8ae tools/ioemu/hw/serial.c
--- a/tools/ioemu/hw/serial.c
+++ b/tools/ioemu/hw/serial.c
@@ -708,12 +708,13 @@ static void serial_save(QEMUFile *f, voi
qemu_put_8s(f,&s->lsr);
qemu_put_8s(f,&s->msr);
qemu_put_8s(f,&s->scr);
- qemu_get_8s(f,&s->fcr);
+ qemu_put_8s(f,&s->fcr);
}
static int serial_load(QEMUFile *f, void *opaque, int version_id)
{
SerialState *s = opaque;
+ uint8_t fcr;
if(version_id > 2)
return -EINVAL;
@@ -730,8 +731,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);
- qemu_get_8s(f,&s->fcr);
-
+ 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 #1.2: Type: text/html, Size: 2308 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2008-05-15 17:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=482C6C6C.5070206@virtualiron.com \
--to=bguthro@virtualiron.com \
--cc=rphillips@virtualiron.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.