qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fix warnings on i386 build
Date: Wed, 19 Nov 2008 09:12:54 -0600	[thread overview]
Message-ID: <49242CF6.2080200@codemonkey.ws> (raw)
In-Reply-To: <1227107680-8103-1-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> i386 builds of kvm shouts warnings about type mismatches
> this patch fixes them.
>
> Signed-off-by: Glauber Costa <glommer@redhat.com>
> ---
>  kvm-all.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 18e9361..d3fcf8b 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -338,7 +338,7 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr,
>  
>              /* Not splitting */
>              if ((phys_offset - (start_addr - mem->guest_phys_addr)) == 
> -                ((uint8_t *)mem->userspace_addr - phys_ram_base))
> +                (mem->userspace_addr - (ram_addr_t)phys_ram_base))
>   

This isn't quite right.  There's no reason ram_addr_t has to be 64-bit.  
If it were 32-bit, this would break badly.

I think a better fix is:

(ram_addr_t)((uint8_t *)mem->userspace_addr - phys_ram_base))


A proper fix would probably be to introduce a real KVMSlot structure 
that used the proper types instead of uint64_t.

Regards,

Anthony Liguori

>                  return;
>  
>              /* unregister whole slot */
> @@ -349,7 +349,7 @@ void kvm_set_phys_mem(target_phys_addr_t start_addr,
>              /* register prefix slot */
>              mem_start = slot.guest_phys_addr;
>              mem_size = start_addr - slot.guest_phys_addr;
> -            mem_offset = (uint8_t *)slot.userspace_addr - phys_ram_base;
> +            mem_offset = slot.userspace_addr - (ram_addr_t)phys_ram_base;
>              if (mem_size)
>                  kvm_set_phys_mem(mem_start, mem_size, mem_offset);
>  
>   

      reply	other threads:[~2008-11-19 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19 15:14 [Qemu-devel] [PATCH] fix warnings on i386 build Glauber Costa
2008-11-19 15:12 ` Anthony Liguori [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=49242CF6.2080200@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).