Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261747AbVBICQ0 (ORCPT ); Tue, 8 Feb 2005 21:16:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261748AbVBICQZ (ORCPT ); Tue, 8 Feb 2005 21:16:25 -0500 Received: from fw.osdl.org ([65.172.181.6]:26812 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S261747AbVBICQT (ORCPT ); Tue, 8 Feb 2005 21:16:19 -0500 Date: Tue, 8 Feb 2005 18:16:15 -0800 (PST) From: Linus Torvalds To: Richard Henderson cc: Ingo Molnar , Kernel Mailing List , Manfred Spraul Subject: Re: out-of-line x86 "put_user()" implementation In-Reply-To: <20050209012741.GB13802@twiddle.net> Message-ID: References: <20050207114415.GA22948@elte.hu> <20050209012741.GB13802@twiddle.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1393 Lines: 34 On Tue, 8 Feb 2005, Richard Henderson wrote: > > On Mon, Feb 07, 2005 at 05:20:06PM -0800, Linus Torvalds wrote: > > +#define __put_user_8(x, ptr) __asm__ __volatile__("call __put_user_8":"=A" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr)) > > This is not constrained enough. The compiler could choose to put the > return value in edx. You want > > __asm__ __volatile__("call __put_user_8":"=a" (__ret_pu) > : "A" ((typeof(*(ptr)))(x)), "c" (ptr)) Hmm.. I always thought "A" was the _pairing_ of %eax/%edx, not "eax or edx"? IOW, as far as I know, I'm telling the compiler that the asm is writing a 64-bit value into %eax:%edx, and that that __ret_pu gets that 64-bit value assigned to it (and truncated, at that point). No? Note that he code that actually writes to the register is the assembly code, and that one always writes to %eax. So the compiler doesn't get to "put the return value" anywhere. It gets told where it is. I'd happily use your version, but I thought that some versions of gcc require that input output registers cannot overlap, and would refuse to do that thing? But if you tell me differently.. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/