From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Atomic operations
Date: 3 Jun 2002 12:49:36 -0700 [thread overview]
Message-ID: <adgh8g$1vm$1@cesium.transmeta.com> (raw)
In-Reply-To: <EE83E551E08D1D43AD52D50B9F5110927E7A10@ntserver2> <3CFBB7DB.831BE453@didntduck.org>
Followup to: <3CFBB7DB.831BE453@didntduck.org>
By author: Brian Gerst <bgerst@didntduck.org>
In newsgroup: linux.dev.kernel
>
> int atomic_xadd(int i, atomic_t *v)
> {
> int ret;
> __asm__(LOCK "xaddl %1,%0"
> : "=m" (v->counter), "=r" (ret)
> : "0" (v->counter), "1" (i));
> return ret;
> }
>
> This one only works on 486+, but there are practically no real 386 SMP
> systems.
>
<slaps forehead>
Boy do I feel dumb now.
The only nitpick is that it's probably better coded as:
int atomic_xadd(int i, atomic_t *v)
{
asm volatile(LOCK "xaddl %1,%0"
: "+m" (v->counter), "+r" (i));
return i;
}
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com>
next prev parent reply other threads:[~2002-06-03 19:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-03 15:04 Atomic operations Gregory Giguashvili
2002-06-03 17:27 ` H. Peter Anvin
2002-06-03 18:08 ` Richard B. Johnson
2002-06-03 19:36 ` Thunder from the hill
2002-06-03 21:30 ` Richard B. Johnson
2002-06-03 18:39 ` Brian Gerst
2002-06-03 19:49 ` H. Peter Anvin [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-06-03 15:58 Gregory Giguashvili
2002-06-03 19:09 Gregory Giguashvili
2002-06-03 18:43 ` H. Peter Anvin
2002-06-04 9:23 Gregory Giguashvili
2009-03-26 0:17 Timothy Hayes
2009-03-26 7:25 ` Keir Fraser
2009-03-26 7:34 ` Juergen Gross
2009-03-26 7:50 ` Keir Fraser
2009-03-27 17:22 ` Timothy Hayes
2009-03-27 17:56 ` Keir Fraser
2009-03-27 20:00 ` Timothy Hayes
2013-02-24 9:42 atomic operations Shraddha Kamat
2013-02-24 10:50 ` richard -rw- weinberger
2013-02-24 23:24 ` Valdis.Kletnieks at vt.edu
2013-02-24 12:50 ` Peter Teoh
2013-02-24 12:53 ` Peter Teoh
2013-02-25 7:15 ` Kumar amit mehta
2013-03-01 5:44 ` Arun KS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='adgh8g$1vm$1@cesium.transmeta.com' \
--to=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.