From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lnhjg-00042t-9W for qemu-devel@nongnu.org; Sat, 28 Mar 2009 19:14:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lnhjf-00041t-7A for qemu-devel@nongnu.org; Sat, 28 Mar 2009 19:14:43 -0400 Received: from [199.232.76.173] (port=36325 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lnhje-00041g-SP for qemu-devel@nongnu.org; Sat, 28 Mar 2009 19:14:42 -0400 Received: from hall.aurel32.net ([88.191.82.174]:57645) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lnhje-0007c5-Bx for qemu-devel@nongnu.org; Sat, 28 Mar 2009 19:14:42 -0400 Date: Sun, 29 Mar 2009 00:14:38 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] substitute structure dump with discrete dump in eeprom_save/load Message-ID: <20090328231438.GC14328@volta.aurel32.net> References: <12353435271060-git-send-email-andre.przywara@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <12353435271060-git-send-email-andre.przywara@amd.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Andre Przywara On Sun, Feb 22, 2009 at 11:58:47PM +0100, Andre Przywara wrote: > 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 Thanks, applied. > --- > hw/eeprom93xx.c | 30 ++++++++++++++++++++++++++++-- > 1 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/hw/eeprom93xx.c b/hw/eeprom93xx.c > index 896cffd..527fdf7 100644 > --- a/hw/eeprom93xx.c > +++ b/hw/eeprom93xx.c > @@ -95,7 +95,19 @@ static void eeprom_save(QEMUFile *f, void *opaque) > /* 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 @@ static int eeprom_load(QEMUFile *f, void *opaque, int version_id) > 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++) { > -- > 1.5.2.2 > > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net