* [Qemu-devel] serial.c: Add support for [load|save]vm
@ 2005-11-05 14:59 Vincent Pelletier
2005-11-05 19:10 ` John R. Hogerhuis
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Pelletier @ 2005-11-05 14:59 UTC (permalink / raw)
To: qemu-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] serial.c: Add support for [load|save]vm
2005-11-05 14:59 [Qemu-devel] serial.c: Add support for [load|save]vm Vincent Pelletier
@ 2005-11-05 19:10 ` John R. Hogerhuis
2005-11-05 20:11 ` Vincent Pelletier
0 siblings, 1 reply; 3+ messages in thread
From: John R. Hogerhuis @ 2005-11-05 19:10 UTC (permalink / raw)
To: qemu-devel
On Sat, 2005-11-05 at 15:59 +0100, Vincent Pelletier wrote:
> 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
> plain text document attachment (serial.c.diff)
> Index: hw/serial.c
What does it do? I'm guessing saving/restoring the virtual serial port
device state?
-- John.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] serial.c: Add support for [load|save]vm
2005-11-05 19:10 ` John R. Hogerhuis
@ 2005-11-05 20:11 ` Vincent Pelletier
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Pelletier @ 2005-11-05 20:11 UTC (permalink / raw)
To: jhoger, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
John R. Hogerhuis wrote:
> What does it do? I'm guessing saving/restoring the virtual serial port
> device state?
Yes. It adds the 2 needed functions and register them with the
saving/loading system.
Vincent Pelletier
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-05 20:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-05 14:59 [Qemu-devel] serial.c: Add support for [load|save]vm Vincent Pelletier
2005-11-05 19:10 ` John R. Hogerhuis
2005-11-05 20:11 ` Vincent Pelletier
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).