qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] hw/usb/dev-network.c: Use ldl_le_p() and stl_le


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] hw/usb/dev-network.c: Use ldl_le_p() and stl_le_p()
Date: Sat, 11 Jun 2016 14:21:39 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/10/2016 09:37 AM, Peter Maydell wrote:
> Use stl_le_p() and ldl_le_p() to read and write data from
> buffers, rather than using pointer casts and cpu_to_le32()
> for writes and le32_to_cpup() for reads. This:
>  * avoids lots of casts
>  * works even if the buffer isn't as aligned as the host would like
>  * avoids using the *_to_cpup() functions which we want to get rid of
> 
> Note that there may still be some places where a pointer from the
> guest is cast to a pointer to a host structure; these would also
> have to be changed for the device to work on a host CPU which
> enforces alignment restrictions.
> 
> Signed-off-by: Peter Maydell <address@hidden>
> ---
>  hw/usb/dev-network.c | 63 
> +++++++++++++++++++++++++---------------------------
>  1 file changed, 30 insertions(+), 33 deletions(-)
> 

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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