qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fix warnings on i386 build


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] fix warnings on i386 build
Date: Wed, 19 Nov 2008 09:12:54 -0600
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Glauber Costa wrote:
i386 builds of kvm shouts warnings about type mismatches
this patch fixes them.

Signed-off-by: Glauber Costa <address@hidden>
---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]