From: Keir Fraser Subject: Re: [PATCH] linux/x86: avoid casting hypercallarguments to long Date: Mon, 21 Jan 2008 17:18:42 +0000 Message-ID: References: <4794D99D.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: <4794D99D.76E4.0078.0@novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 21/1/08 16:42, "Jan Beulich" wrote: >>>> Keir Fraser 21.01.08 17:27 >>> >> On 21/1/08 15:18, "Jan Beulich" wrote: >> > In its type: This way, the type gets promoted to int for anything smaller > than int, but left alone if long (or wider) or pointer. Various gcc versions > appear to have various problems when not promoting to at least int... It's not really clear that passing an int to 64-bit inline asm guarantees that the upper 32 bits of the 64-bit register are zero, is it? If you pass a 32-bit value to inline asm then gcc emits 32-bit register operands. I'll admit it's very *likely* that the value will turn out to be zero-extended, if you go at the argument with an explicit 64-bit access, because of x86_64 register write semantics, but not clear it's guaranteed. >> Is it guaranteed that gcc will keep the register variables in their assigned >> registers across the inline asm? > > That's how they document it, so I suppose this is the canonical way > and can be expected to not break. Is it documented in the 'info gcc' documentation somewhere? -- Keir