svn commit: r253891 - in projects/atomic64/sys: amd64/include i386/include
Konstantin Belousov
kostikbel at gmail.com
Fri Aug 2 19:14:48 UTC 2013
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-projects/attachments/20130802/2a2cc3c7/attachment.sig>
More information about the svn-src-projects
mailing list