All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function.
Date: Tue, 5 Aug 2014 11:01:46 +0100	[thread overview]
Message-ID: <20140805100146.GA1302@redhat.com> (raw)
In-Reply-To: <874mxrl0hz.fsf@linaro.org>

On Tue, Aug 05, 2014 at 10:57:26AM +0100, Alex Bennée wrote:
> 
> Richard W.M. Jones writes:
> 
> > As the name suggests this lets you load a ROM/disk image that is
> > gzipped.  It is uncompressed before storing it in guest memory.
> >
> > Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> <snip>
> > +    /* Is it a gzip-compressed file? */
> > +    if (len < 2 ||
> > +        compressed_data[0] != '\x1f' ||
> > +        compressed_data[1] != '\x8b') {
> > +        goto out;
> > +    }
> <snip>
> 
> Hmm serves me right for not compiling this first. I had to explicit
> literals to get this to compile:
> 
> 	Modified   hw/core/loader.c
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index e773aab..83136e8 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -599,8 +599,8 @@ int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz)
>  
>      /* Is it a gzip-compressed file? */
>      if (len < 2 ||
> -        compressed_data[0] != '\x1f' ||
> -        compressed_data[1] != '\x8b') {
> +        compressed_data[0] != 0x1f ||
> +        compressed_data[1] != 0x8b ) {
>          goto out;
>      }
> 
> Otherwise I get:
> hw/core/loader.c: In function ‘load_image_gzipped’:
> hw/core/loader.c:603:9: error: comparison is always true due to limited range of data type [-Werror=type-limits]
>          compressed_data[1] != '\x8b') {

This is probably because I only compiled and tested this on aarch64
where char == unsigned char (not signed char).

I'll fix this in v6, thanks.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

  reply	other threads:[~2014-08-05 10:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 11:47 [Qemu-devel] [PATCH v5 0/2] aarch64: Allow -kernel option to take a gzip-compressed kernel Richard W.M. Jones
2014-08-04 11:47 ` [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function Richard W.M. Jones
2014-08-05  9:52   ` Alex Bennée
2014-08-05  9:57   ` Alex Bennée
2014-08-05 10:01     ` Richard W.M. Jones [this message]
2014-08-04 11:47 ` [Qemu-devel] [PATCH v5 2/2] aarch64: Allow -kernel option to take a gzip-compressed kernel Richard W.M. Jones
2014-08-05 10:00   ` Alex Bennée

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=20140805100146.GA1302@redhat.com \
    --to=rjones@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --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.