Date: Fri, 2 Aug 2013 22:14:42 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Jung-uk Kim <jkim@FreeBSD.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r253891 - in projects/atomic64/sys: amd64/include i386/include Message-ID: <20130802191442.GD4972@kib.kiev.ua> In-Reply-To: <201308021832.r72IW2pR034687@svn.freebsd.org> References: <201308021832.r72IW2pR034687@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--NEAn2rYUJijllS+S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > Log: > Allow an immediate for the bit number. > =20 > Suggested by: >=20 > Modified: > projects/atomic64/sys/amd64/include/atomic.h > projects/atomic64/sys/i386/include/atomic.h >=20 > Modified: projects/atomic64/sys/amd64/include/atomic.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- 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" > : "=3Dr" (res), /* 0 */ > "=3Dm" (*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" > : "=3Dr" (res), /* 0 */ > "=3Dm" (*p) /* 1 */ > - : "r" ((u_long)v), /* 2 */ > + : "Jr" ((u_long)v % 64), /* 2 */ > "m" (*p) /* 3 */ > : "cc"); > return (res); >=20 > Modified: projects/atomic64/sys/i386/include/atomic.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- 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" > - : "=3Dr" (res), /* 0 (result) */ > + : "=3Dr" (res), /* 0 */ > "=3Dm" (*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. --NEAn2rYUJijllS+S Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJR/AUiAAoJEJDCuSvBvK1BMUQP/iXHMoCOb7tqPrwCe2glUlyI n2Rcbb4TirC2gVAUddwAga8+d3RufKZMvuVY4QocNM5Bb6jtm7t5pPNCHwAPdETT 3v0ulbDSg1POkUZNi6FtOuaOrkYpsFnfq9sfwBQjxidWWGvE/vacScwfgcoQDb9M ReoQ9e83Tt9TlfUDC2KbDf1i4ZUq6v04dD/FcJBniNddWRQtjiUvbm/uuRXToK92 hnosDgKdwzYPMkDeoew9iII9qg9nXIaasJ3LguuInPHO1xvB51mM/WxYKlw/OKJM SImXNfokgaK38Xwk27sfw0BpQoXxNlN0yMHIiTK+fU1N5aIfCFZk8V9Mihcotya6 mZkIuVlkAUBqHyVUarPKwiEpRjS3qJSVlxj1aIg5q/wynGxAgSTpJ4+3Iy4dT9Uy 0ksQkCSOefLrcHbbg77gpdsErhIM9JcPeJ5sd8eZ+JPM3VlaLbbunSPF80ng4Sk5 hVWXxMMVuyiM++hARNurqdCZAF4mD88pE4TsUDRQ2f4wYe4/+IGEyejZwbeE7/Hr JAyDU2kXG9bzcVavY+SisKL/Jv7H9aiztaUv3D8ww6nto3+nCvcp8B8Hk+WVjXhd RFrnCYsxgDELE3ZsIGrf56M4koF39BdRTJyA7Y/lge930WIpbbzIYaB/033rbrmC sm+fyCWJWdRO7WOmcqu+ =RyM8 -----END PGP SIGNATURE----- --NEAn2rYUJijllS+S--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130802191442.GD4972>