From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LbNHt-0006VS-Sw for qemu-devel@nongnu.org; Sun, 22 Feb 2009 17:59:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LbNHs-0006UT-5u for qemu-devel@nongnu.org; Sun, 22 Feb 2009 17:59:04 -0500 Received: from [199.232.76.173] (port=36233 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbNHs-0006UQ-05 for qemu-devel@nongnu.org; Sun, 22 Feb 2009 17:59:04 -0500 Received: from wa4ehsobe005.messaging.microsoft.com ([216.32.181.15]:26910 helo=WA4EHSOBE005.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1LbNHr-0003Ub-IG for qemu-devel@nongnu.org; Sun, 22 Feb 2009 17:59:03 -0500 Received: from mail100-wa4 (localhost.localdomain [127.0.0.1]) by mail100-wa4-R.bigfish.com (Postfix) with ESMTP id 82A52F280A3 for ; Sun, 22 Feb 2009 22:59:01 +0000 (UTC) Received: from ausb3extmailp01.amd.com (unknown [163.181.251.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail100-wa4.bigfish.com (Postfix) with ESMTP id EC061F40056 for ; Sun, 22 Feb 2009 22:58:59 +0000 (UTC) Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n1MMwrPJ016411 for ; Sun, 22 Feb 2009 16:58:56 -0600 Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 2979516A04C3 for ; Sun, 22 Feb 2009 16:58:43 -0600 (CST) From: Andre Przywara Date: Sun, 22 Feb 2009 23:58:47 +0100 Message-ID: <12353435271060-git-send-email-andre.przywara@amd.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] substitute structure dump with discrete dump in eeprom_save/load 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 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 --- 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