* [Qemu-devel] [6917] hw/eeprom93xx.c: substitute structure dump with discrete dump in eeprom_save/load
@ 2009-03-28 23:14 Aurelien Jarno
0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2009-03-28 23:14 UTC (permalink / raw)
To: qemu-devel
Revision: 6917
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6917
Author: aurel32
Date: 2009-03-28 23:14:41 +0000 (Sat, 28 Mar 2009)
Log Message:
-----------
hw/eeprom93xx.c: substitute structure dump with discrete dump in eeprom_save/load
The EEPROM 93xx device used to dump a C structure to the migration stream.
This structure includes mixed 8 and 16bit variables and is thus subject to
compiler dependent padding. Replace this with discrete dumps of each member
(and add a padding byte to ensure compatibility, a version update is
included in the following patch).
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Modified Paths:
--------------
trunk/hw/eeprom93xx.c
Modified: trunk/hw/eeprom93xx.c
===================================================================
--- trunk/hw/eeprom93xx.c 2009-03-28 23:14:32 UTC (rev 6916)
+++ trunk/hw/eeprom93xx.c 2009-03-28 23:14:41 UTC (rev 6917)
@@ -95,7 +95,19 @@
/* Save EEPROM data. */
unsigned address;
eeprom_t *eeprom = (eeprom_t *)opaque;
- qemu_put_buffer(f, (uint8_t *)eeprom, sizeof(*eeprom) - 2);
+
+ qemu_put_byte(f, eeprom->tick);
+ qemu_put_byte(f, eeprom->address);
+ qemu_put_byte(f, eeprom->command);
+ qemu_put_byte(f, eeprom->writeable);
+
+ qemu_put_byte(f, eeprom->eecs);
+ qemu_put_byte(f, eeprom->eesk);
+ qemu_put_byte(f, eeprom->eedo);
+
+ qemu_put_byte(f, eeprom->addrbits);
+ qemu_put_byte(f, eeprom->size);
+ qemu_put_byte(f, 0); /* padding for compatiblity */
qemu_put_be16(f, eeprom->data);
for (address = 0; address < eeprom->size; address++) {
qemu_put_be16(f, eeprom->contents[address]);
@@ -111,7 +123,20 @@
if (version_id == eeprom_version) {
unsigned address;
uint8_t size = eeprom->size;
- qemu_get_buffer(f, (uint8_t *)eeprom, sizeof(*eeprom) - 2);
+
+ eeprom->tick = qemu_get_byte(f);
+ eeprom->address = qemu_get_byte(f);
+ eeprom->command = qemu_get_byte(f);
+ eeprom->writeable = qemu_get_byte(f);
+
+ eeprom->eecs = qemu_get_byte(f);
+ eeprom->eesk = qemu_get_byte(f);
+ eeprom->eedo = qemu_get_byte(f);
+
+ eeprom->addrbits = qemu_get_byte(f);
+ eeprom->size = qemu_get_byte(f);
+ qemu_get_byte(f); /* skip padding byte */
+
if (eeprom->size == size) {
eeprom->data = qemu_get_be16(f);
for (address = 0; address < eeprom->size; address++) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-28 23:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-28 23:14 [Qemu-devel] [6917] hw/eeprom93xx.c: substitute structure dump with discrete dump in eeprom_save/load Aurelien Jarno
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).