qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length
@ 2013-07-08  8:44 Peter Maydell
  2013-07-09  8:47 ` Riku Voipio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2013-07-08  8:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, patches

Commit e3127ae0 introduced a problem where we're passing a
hwaddr* to qemu_ram_ptr_length() but it wants a ram_addr_t*;
this will cause problems on 32 bit hosts and in any case
provokes a clang warning on MacOSX:

  CC    arm-softmmu/exec.o
exec.c:2164:46: warning: incompatible pointer types passing 'hwaddr *'
(aka 'unsigned long long *') to parameter of type 'ram_addr_t *'
(aka 'unsigned long *')
[-Wincompatible-pointer-types]
    return qemu_ram_ptr_length(raddr + base, plen);
                                             ^~~~
exec.c:1392:63: note: passing argument to parameter 'size' here
static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
                                                              ^

Since this function is only used in one place, change its
prototype to pass a hwaddr* rather than a ram_addr_t*,
rather than contorting the calling code to get the type right.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 03fdf7e..50d29de 100644
--- a/exec.c
+++ b/exec.c
@@ -1389,7 +1389,7 @@ static void *qemu_safe_ram_ptr(ram_addr_t addr)
 
 /* Return a host pointer to guest's ram. Similar to qemu_get_ram_ptr
  * but takes a size argument */
-static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
+static void *qemu_ram_ptr_length(ram_addr_t addr, hwaddr *size)
 {
     if (*size == 0) {
         return NULL;
-- 
1.7.11.4

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

* Re: [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length
  2013-07-08  8:44 [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length Peter Maydell
@ 2013-07-09  8:47 ` Riku Voipio
  2013-07-12  6:46 ` Peter Crosthwaite
  2013-07-15 13:49 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Riku Voipio @ 2013-07-09  8:47 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, patches

On Mon, Jul 08, 2013 at 09:44:04AM +0100, Peter Maydell wrote:
> Commit e3127ae0 introduced a problem where we're passing a
> hwaddr* to qemu_ram_ptr_length() but it wants a ram_addr_t*;
> this will cause problems on 32 bit hosts and in any case
> provokes a clang warning on MacOSX:

Bumped into this warning when compiling QEMU on ARM host as well,
this pax fixes it.

Tested-by: Riku Voipio <riku.voipio@linaro.org>

>   CC    arm-softmmu/exec.o
> exec.c:2164:46: warning: incompatible pointer types passing 'hwaddr *'
> (aka 'unsigned long long *') to parameter of type 'ram_addr_t *'
> (aka 'unsigned long *')
> [-Wincompatible-pointer-types]
>     return qemu_ram_ptr_length(raddr + base, plen);
>                                              ^~~~
> exec.c:1392:63: note: passing argument to parameter 'size' here
> static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
>                                                               ^
> 
> Since this function is only used in one place, change its
> prototype to pass a hwaddr* rather than a ram_addr_t*,
> rather than contorting the calling code to get the type right.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/exec.c b/exec.c
> index 03fdf7e..50d29de 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1389,7 +1389,7 @@ static void *qemu_safe_ram_ptr(ram_addr_t addr)
>  
>  /* Return a host pointer to guest's ram. Similar to qemu_get_ram_ptr
>   * but takes a size argument */
> -static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
> +static void *qemu_ram_ptr_length(ram_addr_t addr, hwaddr *size)
>  {
>      if (*size == 0) {
>          return NULL;
> -- 
> 1.7.11.4
> 

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

* Re: [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length
  2013-07-08  8:44 [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length Peter Maydell
  2013-07-09  8:47 ` Riku Voipio
@ 2013-07-12  6:46 ` Peter Crosthwaite
  2013-07-15 13:49 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Crosthwaite @ 2013-07-12  6:46 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, patches

Unbreaks one of my builds.

replicated with:

./configure --target-list=arm-softmmu --cpu=i386

On Mon, Jul 8, 2013 at 6:44 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Commit e3127ae0 introduced a problem where we're passing a
> hwaddr* to qemu_ram_ptr_length() but it wants a ram_addr_t*;
> this will cause problems on 32 bit hosts and in any case
> provokes a clang warning on MacOSX:
>
>   CC    arm-softmmu/exec.o
> exec.c:2164:46: warning: incompatible pointer types passing 'hwaddr *'
> (aka 'unsigned long long *') to parameter of type 'ram_addr_t *'
> (aka 'unsigned long *')
> [-Wincompatible-pointer-types]
>     return qemu_ram_ptr_length(raddr + base, plen);
>                                              ^~~~
> exec.c:1392:63: note: passing argument to parameter 'size' here
> static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
>                                                               ^
>
> Since this function is only used in one place, change its
> prototype to pass a hwaddr* rather than a ram_addr_t*,
> rather than contorting the calling code to get the type right.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Tested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/exec.c b/exec.c
> index 03fdf7e..50d29de 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1389,7 +1389,7 @@ static void *qemu_safe_ram_ptr(ram_addr_t addr)
>
>  /* Return a host pointer to guest's ram. Similar to qemu_get_ram_ptr
>   * but takes a size argument */
> -static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
> +static void *qemu_ram_ptr_length(ram_addr_t addr, hwaddr *size)
>  {
>      if (*size == 0) {
>          return NULL;
> --
> 1.7.11.4
>
>

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

* Re: [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length
  2013-07-08  8:44 [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length Peter Maydell
  2013-07-09  8:47 ` Riku Voipio
  2013-07-12  6:46 ` Peter Crosthwaite
@ 2013-07-15 13:49 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-07-15 13:49 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Il 08/07/2013 10:44, Peter Maydell ha scritto:
> Commit e3127ae0 introduced a problem where we're passing a
> hwaddr* to qemu_ram_ptr_length() but it wants a ram_addr_t*;
> this will cause problems on 32 bit hosts and in any case
> provokes a clang warning on MacOSX:
> 
>   CC    arm-softmmu/exec.o
> exec.c:2164:46: warning: incompatible pointer types passing 'hwaddr *'
> (aka 'unsigned long long *') to parameter of type 'ram_addr_t *'
> (aka 'unsigned long *')
> [-Wincompatible-pointer-types]
>     return qemu_ram_ptr_length(raddr + base, plen);
>                                              ^~~~
> exec.c:1392:63: note: passing argument to parameter 'size' here
> static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
>                                                               ^
> 
> Since this function is only used in one place, change its
> prototype to pass a hwaddr* rather than a ram_addr_t*,
> rather than contorting the calling code to get the type right.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/exec.c b/exec.c
> index 03fdf7e..50d29de 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1389,7 +1389,7 @@ static void *qemu_safe_ram_ptr(ram_addr_t addr)
>  
>  /* Return a host pointer to guest's ram. Similar to qemu_get_ram_ptr
>   * but takes a size argument */
> -static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
> +static void *qemu_ram_ptr_length(ram_addr_t addr, hwaddr *size)
>  {
>      if (*size == 0) {
>          return NULL;
> 

Thanks, applying it to my memory tree.

Paolo

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

end of thread, other threads:[~2013-07-15 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-08  8:44 [Qemu-devel] [PATCH] exec.c: Pass correct pointer type to qemu_ram_ptr_length Peter Maydell
2013-07-09  8:47 ` Riku Voipio
2013-07-12  6:46 ` Peter Crosthwaite
2013-07-15 13:49 ` Paolo Bonzini

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