From: "Jan Beulich" Subject: Re: [PATCH] add canonical address checks to HVM Date: Fri, 01 Dec 2006 11:10:04 +0000 Message-ID: <45701B9C.76E4.0078.0@novell.com> References: <456DAFBE.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> Keir Fraser 01.12.06 11:12 >>> >On 29/11/06 15:05, "Jan Beulich" 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