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

Re: [Xen-devel] [Qemu-devel] [PATCH 2/2] Xen: Add xen-apic support and hook it up.



On 11 April 2012 17:13, Jan Kiszka <jan.kiszka@xxxxxxxxxxx> wrote:
> On 2012-04-11 18:07, Peter Maydell wrote:
>>> +#include "hw/apic_internal.h"
>>> +#include "hw/msi.h"
>>> +#include "xen.h"
>>> +
>>> +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr,
>>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned size)
>>> +{
>>> + Â Âreturn -1U;
>>> +}
>>
>> This seems a rather confusing way to write 'return 0xffffffff;'
>
> You mean 0xffffffffffffffff? :)

No, that's why it's confusing :-)

1U is the integer constant 1 with a type of 'unsigned int'
(cf C99 section 6.4.4.1). It then has the unary negation
operator applied to it, giving (for the usual 32 bit integer
case) 0xffffffff. This is then cast from 'unsigned int'
to 'uint64_t' giving 0xffffffff as a 64 bit unsigned value.

(I had to write a test program to (a) confirm what it was
going to return and (b) that it would be the same thing on
both 32 and 64 bit systems...)

I have no opinion on what the return value actually ought
to be.

-- PMM

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.