qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] linux-user: fix preadv/pwritev offsets


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH] linux-user: fix preadv/pwritev offsets
Date: Thu, 5 Apr 2018 13:40:37 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 04/05/2018 11:33 AM, Max Filippov wrote:
> +static void target_low_high_to_host_low_high(abi_ulong tlow,
> +                                             abi_ulong thigh,
> +                                             unsigned long *hlow,
> +                                             unsigned long *hhigh)
> +{
> +#if TARGET_LONG_BITS == HOST_LONG_BITS
> +        *hlow = tlow;
> +        *hhigh = thigh;
> +#elif TARGET_LONG_BITS < HOST_LONG_BITS
> +        *hlow = tlow | (unsigned long)thigh << TARGET_LONG_BITS;
> +        *hhigh = 0;
> +#else
> +        *hlow = (unsigned long)tlow;
> +        *hhigh = (unsigned long)(thigh >> HOST_LONG_BITS);
> +#endif

This third clause does not look right.

It might have been thigh >> HOST_LONG_BITS, which is good for the specific
cases (32, 64) that we will always have.  But you'd certainly want to not
pretend otherwise by only checking relative sizes.


r~



reply via email to

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