qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] vfio: Fix 128 bit handling


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/2] vfio: Fix 128 bit handling
Date: Thu, 22 Aug 2013 07:36:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

Il 22/08/2013 04:02, Alexey Kardashevskiy ha scritto:
>> Int128 is opaque, please use int128_and.  To build the constant you have
>> three choices (from my preferred to IMHO worst):
>>
>> - add a new int128_exts64 function that sign-extends an int64_t
> 
> Like this? I am really scared to screw here :)
> 
> static inline Int128 int128_exts64(int64_t a)
> {
>     return (Int128) { .lo = a, .hi = (a < 0) ? -1 : 0 };
> }

Yes, or just a >> 63.

>> - use int128_neg(int128_make64(TARGET_PAGE_SIZE)) or something like that
> 
> Did you actually mean TARGET_PAGE_SIZE-1 (with -1)? I'll better use this
> for now.

it would be either ~(TARGET_PAGE_SIZE-1) or -TARGET_PAGE_SIZE, I think.

>> - add a new int128_make function that takes a low/high pair and use
>> int128_make(TARGET_PAGE_MASK, -1)
> 
> I liked this one actually but you called it "worst" :)

It is really the same as #1 but inlined, which is why I called it the worst.

#2 is ugly for a different reason, namely because it changes the code
more substantially, from using TARGET_PAGE_MASK pre-patch to
TARGET_PAGE_SIZE post-patch.

Paolo



reply via email to

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