From: Vincent Pelletier <subdino2004@yahoo.fr>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] serial.c: Add support for [load|save]vm
Date: Sat, 05 Nov 2005 15:59:55 +0100 [thread overview]
Message-ID: <436CC8EB.8010207@yahoo.fr> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 407 bytes --]
Hi.
I posted it on the forum, but as I prefer mailing lists, I post it here.
(btw : it tok about one hour for the ML "registration" confirmation
message to came in my mailbox, that's why I posted on the forum first)
2005-11-05 Vincent Pelletier <subdino2004@yaho.fr>
* hw/serial.c (serial_save, serial_load): New functions.
(serial_init): Register added functions in savevm system.
Vincent Pelletier
[-- Attachment #1.2: serial.c.diff --]
[-- Type: text/plain, Size: 1665 bytes --]
Index: hw/serial.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/serial.c,v
retrieving revision 1.7
diff -u -p -r1.7 serial.c
--- hw/serial.c 24 Aug 2004 21:55:28 -0000 1.7
+++ hw/serial.c 4 Nov 2005 09:49:44 -0000
@@ -258,6 +258,41 @@ static void serial_event(void *opaque, i
serial_receive_break(s);
}
+static void serial_save(QEMUFile *f, void *opaque)
+{
+ SerialState *s = opaque;
+
+ qemu_put_8s(f,&s->divider);
+ qemu_put_8s(f,&s->rbr);
+ qemu_put_8s(f,&s->ier);
+ qemu_put_8s(f,&s->iir);
+ qemu_put_8s(f,&s->lcr);
+ qemu_put_8s(f,&s->mcr);
+ qemu_put_8s(f,&s->lsr);
+ qemu_put_8s(f,&s->msr);
+ qemu_put_8s(f,&s->scr);
+}
+
+static int serial_load(QEMUFile *f, void *opaque, int version_id)
+{
+ SerialState *s = opaque;
+
+ if(version_id != 1)
+ return -EINVAL;
+
+ qemu_get_8s(f,&s->divider);
+ qemu_get_8s(f,&s->rbr);
+ qemu_get_8s(f,&s->ier);
+ qemu_get_8s(f,&s->iir);
+ qemu_get_8s(f,&s->lcr);
+ qemu_get_8s(f,&s->mcr);
+ qemu_get_8s(f,&s->lsr);
+ qemu_get_8s(f,&s->msr);
+ qemu_get_8s(f,&s->scr);
+
+ return 0;
+}
+
/* If fd is zero, it means that the serial device uses the console */
SerialState *serial_init(int base, int irq, CharDriverState *chr)
{
@@ -269,6 +304,8 @@ SerialState *serial_init(int base, int i
s->irq = irq;
s->lsr = UART_LSR_TEMT | UART_LSR_THRE;
s->iir = UART_IIR_NO_INT;
+
+ register_savevm("serial", base, 1, serial_save, serial_load, s);
register_ioport_write(base, 8, 1, serial_ioport_write, s);
register_ioport_read(base, 8, 1, serial_ioport_read, s);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-11-05 15:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-05 14:59 Vincent Pelletier [this message]
2005-11-05 19:10 ` [Qemu-devel] serial.c: Add support for [load|save]vm John R. Hogerhuis
2005-11-05 20:11 ` Vincent Pelletier
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=436CC8EB.8010207@yahoo.fr \
--to=subdino2004@yahoo.fr \
--cc=qemu-devel@nongnu.org \
/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 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).