qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] cpu-common: Modify cpu_physical_memory_read


From: Artyom Tarasenko
Subject: Re: [Qemu-devel] [PATCH 1/3] cpu-common: Modify cpu_physical_memory_read and cpu_physical_memory_write
Date: Sun, 10 Apr 2011 14:37:32 +0200

On Sat, Mar 26, 2011 at 9:06 PM, Stefan Weil <address@hidden> wrote:
> A lot of calls don't operate on bytes but on words or on structured data.
> So instead of a pointer to uint8_t, a void pointer is the better choice.

Wouldn't it make the endianness conversions more complex? uint8_t[]
has a very obvious byte order,
structured data doesn't.

> This allows removing many type casts.
>
> (Some very early implementations of memcpy used char pointers
> which were replaced by void pointers for the same reason).
>
> Cc: Blue Swirl <address@hidden>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>  cpu-common.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cpu-common.h b/cpu-common.h
> index ef4e8da..f44a2b0 100644
> --- a/cpu-common.h
> +++ b/cpu-common.h
> @@ -68,12 +68,12 @@ void cpu_unregister_io_memory(int table_address);
>  void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
>                             int len, int is_write);
>  static inline void cpu_physical_memory_read(target_phys_addr_t addr,
> -                                            uint8_t *buf, int len)
> +                                            void *buf, int len)
>  {
>     cpu_physical_memory_rw(addr, buf, len, 0);
>  }
>  static inline void cpu_physical_memory_write(target_phys_addr_t addr,
> -                                             const uint8_t *buf, int len)
> +                                             const void *buf, int len)
>  {
>     cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1);
>  }
> --
> 1.7.2.5
>
>
>



-- 
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/



reply via email to

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