qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH] fix warnings on i386 build
  2008-11-19 15:14 [Qemu-devel] [PATCH] fix warnings on i386 build Glauber Costa
@ 2008-11-19 15:12 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2008-11-19 15:12 UTC (permalink / raw)
  To: qemu-devel

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);
>  
>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH] fix warnings on i386 build
@ 2008-11-19 15:14 Glauber Costa
  2008-11-19 15:12 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Glauber Costa @ 2008-11-19 15:14 UTC (permalink / raw)
  To: qemu-devel

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))
                 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);
 
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-19 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19 15:14 [Qemu-devel] [PATCH] fix warnings on i386 build Glauber Costa
2008-11-19 15:12 ` Anthony Liguori

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).