From owner-svn-src-all@FreeBSD.ORG Mon May 28 14:29:40 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 715D7106566B; Mon, 28 May 2012 14:29:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id F29D98FC0A; Mon, 28 May 2012 14:29:39 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q4SETUR3029500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 29 May 2012 00:29:31 +1000 Date: Tue, 29 May 2012 00:29:30 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov In-Reply-To: <20120528133633.GB2358@deviant.kiev.zoral.com.ua> Message-ID: <20120529002201.C1877@besplex.bde.org> References: <201205252150.q4PLomFk035064@svn.freebsd.org> <20120526173233.A885@besplex.bde.org> <20120526164927.GU2358@deviant.kiev.zoral.com.ua> <20120527043827.W3357@besplex.bde.org> <20120528133633.GB2358@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Ed Schouten , rwatson@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, jonathan@FreeBSD.org Subject: Re: svn commit: r236026 - in head/sys: amd64/linux32 compat/freebsd32 kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2012 14:29:40 -0000 On Mon, 28 May 2012, Konstantin Belousov wrote: > On Sun, May 27, 2012 at 07:49:36AM +1000, Bruce Evans wrote: >> On Sat, 26 May 2012, Konstantin Belousov wrote: >> >>> On Sat, May 26, 2012 at 10:21:25PM +1000, Bruce Evans wrote: >>> The 'low level' AKA magic happens in several *_fetch_syscall_args() >>> functions. For both linux32 and freebsd32, the magic code automatically >>> zero-extends the arguments into 64bit entities. Linux passes args in >>> registers, while FreeBSD uses words on stack. >> >> Actually, the amd64 linux_fetch32_fetch_syscall_args() just copies from >> 64-bit registers frame->tf_r* to 64-bit sa->args[*]. I can't see how >> this gives anything except garbage in the top bits. Is there magic in >> the switch to 64-bit mode that sets the top bits? Anyway, sign extension >> would give garbage for unsigned args, and zero-extension would give >> garbage for negative signed args. > Hardware zero-extends any register touched in the 32bit mode. So they have garbage extension when not touched? Or maybe the kernel extends them. > In fact, please see r217991 for related bug. That seems to be the kernel extending them. I tested on a kernel built on 3 Mar 2012. It is much later than that, and shows nonzero extensions (about half of the wrong cases sign extensions). Bruce