diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-28 23:14:41 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-28 23:14:41 +0000 |
commit | d4ae799cd164aa80a25e52ac09aceb7ff9732ac9 (patch) | |
tree | 73f35a8a444b581d946bc7bd62e904dc60c6b336 /hw/eeprom93xx.c | |
parent | e8afa06581cb7ea808d6568d4106eb1b6f1ab334 (diff) |
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>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6917 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/eeprom93xx.c')
-rw-r--r-- | hw/eeprom93xx.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/hw/eeprom93xx.c b/hw/eeprom93xx.c index 896cffd441..1d546e2c54 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++) { |