qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [BUGFIX][PATCH v7 1/9] vmport: The io memory region nee


From: Eric Blake
Subject: Re: [Qemu-devel] [BUGFIX][PATCH v7 1/9] vmport: The io memory region needs to be at least a size of 4
Date: Mon, 15 Jun 2015 09:09:16 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 06/15/2015 07:53 AM, Don Slutz wrote:
> On 06/12/15 18:38, Eric Blake wrote:

>>>  
>>> +    /* Only support 1 address */
>>> +    if (addr) {
>>> +        return ~0U;
>>> +    }
>>
>> Different answer on 32-bit platforms (there, ~0U is 0xffffffff, which
>> then 0-extends to uint64_t rather than your desired result of
>> 0xffffffffffffffffULL).
>>
> 
> This is not true:

Oh, I was confusing ~0UL (where sign extension on 32- vs 64-bit matters)
and ~0U (which you used).

> 
>> Why can't you just 'return -1;'?
>>
> 
> I/O instructions on x86 are limited to 32bits max.  Also when EAX is
> changed via inl, the high 32bits are 0.  So the correct result is ~0U
> not -1.

Still, it might be better to write an explicit 0xffffffff or even have a
named constant, rather than making people reason about whether ~0U
promotes into a 64-bit value with only 32 bits set.

-- 
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]