WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] add canonical address checks to HVM

To: "Keir Fraser" <keir@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] add canonical address checks to HVM
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Fri, 01 Dec 2006 11:10:04 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 01 Dec 2006 03:09:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C195B07C.55A6%keir@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <456DAFBE.76E4.0078.0@xxxxxxxxxx> <C195B07C.55A6%keir@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> Keir Fraser <keir@xxxxxxxxxxxxx> 01.12.06 11:12 >>>
>On 29/11/06 15:05, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:
>
>> +#ifdef __x86_64__
>> +#define IS_CANO_ADDRESS(add) (((long)(add) >> 47) == ((long)(add) >> 63))
>> +#else
>> +#define IS_CANO_ADDRESS(add) 1
>> +#endif
>> +
>
>Is there any guarantee that right-shift is signed when using gcc?

I suppose so, I believe this is assumed to be that way in various other places.
However, I'm not sure I have an idea where I could look up implementation
defined behavior for gcc.

>How about (int16_t)((add) >> 48) == -(int)(((add) >> 47) & 1) ??

Sure, should work too, but would incur more overhead. I was actually trying
to even avoid the two shifts, but I wasn't able to find something that would
use just one *and* would be faster than the version I submitted.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel