All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: Andre Przywara <andre.przywara@amd.com>
Subject: Re: [Qemu-devel] [PATCH] substitute structure dump with discrete dump in eeprom_save/load
Date: Sun, 29 Mar 2009 00:14:38 +0100	[thread overview]
Message-ID: <20090328231438.GC14328@volta.aurel32.net> (raw)
In-Reply-To: <12353435271060-git-send-email-andre.przywara@amd.com>

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 <andre.przywara@amd.com>

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

      parent reply	other threads:[~2009-03-28 23:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-22 22:58 [Qemu-devel] [PATCH] substitute structure dump with discrete dump in eeprom_save/load Andre Przywara
2009-02-22 23:02 ` [Qemu-devel] [PATCH] support 93xx EEPROMs with more than 255 words Andre Przywara
2009-03-28 23:14   ` Aurelien Jarno
2009-03-28 23:14 ` Aurelien Jarno [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090328231438.GC14328@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=andre.przywara@amd.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.