From owner-svn-src-projects@FreeBSD.ORG Fri Aug 2 19:37:21 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by hub.freebsd.org (Postfix) with ESMTP id 114A73DF; Fri, 2 Aug 2013 19:37:20 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Message-ID: <51FC0A17.3040402@FreeBSD.org> Date: Fri, 02 Aug 2013 15:35:51 -0400 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130715 Thunderbird/17.0.7 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r253891 - in projects/atomic64/sys: amd64/include i386/include References: <201308021832.r72IW2pR034687@svn.freebsd.org> <20130802191442.GD4972@kib.kiev.ua> In-Reply-To: <20130802191442.GD4972@kib.kiev.ua> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2013 19:37:21 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-08-02 15:14:42 -0400, Konstantin Belousov wrote: > On Fri, Aug 02, 2013 at 06:32:02PM +0000, Jung-uk Kim wrote: >> Author: jkim Date: Fri Aug 2 18:32:01 2013 New Revision: 253891 >> URL: http://svnweb.freebsd.org/changeset/base/253891 >> >> Log: Allow an immediate for the bit number. >> >> Suggested by: >> >> Modified: projects/atomic64/sys/amd64/include/atomic.h >> projects/atomic64/sys/i386/include/atomic.h >> >> Modified: projects/atomic64/sys/amd64/include/atomic.h >> ============================================================================== >> >> - --- projects/atomic64/sys/amd64/include/atomic.h Fri Aug 2 18:05:42 2013 (r253890) >> +++ projects/atomic64/sys/amd64/include/atomic.h Fri Aug 2 >> 18:32:01 2013 (r253891) @@ -225,7 +225,7 @@ >> atomic_testandset_int(volatile u_int *p, "# >> atomic_testandset_int" : "=r" (res), /* 0 */ "=m" (*p) /* 1 >> */ - : "r" (v), /* 2 */ + : "Ir" (v % 32), /* 2 */ "m" (*p) >> /* 3 */ : "cc"); return (res); @@ -243,7 +243,7 @@ >> atomic_testandset_long(volatile u_long * "# >> atomic_testandset_long" : "=r" (res), /* 0 */ "=m" (*p) /* 1 >> */ - : "r" ((u_long)v), /* 2 */ + : "Jr" ((u_long)v % 64), /* 2 >> */ "m" (*p) /* 3 */ : "cc"); return (res); >> >> Modified: projects/atomic64/sys/i386/include/atomic.h >> ============================================================================== >> >> - --- projects/atomic64/sys/i386/include/atomic.h Fri Aug 2 18:05:42 2013 (r253890) >> +++ projects/atomic64/sys/i386/include/atomic.h Fri Aug 2 >> 18:32:01 2013 (r253891) @@ -364,9 +364,9 @@ >> atomic_testandset_int(volatile u_int *p, " btsl %2, %1 ; " " setc >> %0 ; " "# atomic_testandset_int" - : "=r" (res), /* 0 (result) >> */ + : "=r" (res), /* 0 */ "=m" (*p) /* 1 */ - : "r" (v), >> /* 2 */ + : "Ir" (v % 32), /* 2 */ "m" (*p) /* 3 */ : "cc"); >> return (res); > > You should also adjust the pointer then, to compensate the clamp > of the bit number. Bit operations apparently work on > arbitrary-length bitstrings. It seems I missed note section of the i386 manual. :-( Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJR/AoXAAoJECXpabHZMqHOFLkIAIp8yFLiGGDGuT1M80sj2kRV qEECAV3mncbuAynS1sjKFeCDpv4fJCtcWbqmDmn6QFDE3utkGaFaseSdoyhgMzUs laoiLuulfrSHg7E6VfOgUFEdBWZt+zyBsigM60RlGV/7qW8J/W42xYtJwurjO6a1 eRErfHxCdRvTc1I/PXZQXF0bPySIciJOVJXAKLThgCG92TGXWjEh78zwYoSSQ5Jl JG39HyaDrkqDna/eh9nZ8iyvyJWE5MckhgP6MCEYNuZzM8mYDRiOBOITZ7/OF40o 8ePCD/6eE59gg76ODj57X+stWCPP+KMZftc9WfXiGieVrJSdpL/Mq81xU8X90dU= =Mcwe -----END PGP SIGNATURE-----