Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2001 15:49:58 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Arun Sharma <arun@sharmas.dhs.org>
Cc:        hackers@FreeBSD.org, Bernd Walter <ticso@mail.cicely.de>
Subject:   Re: Need a clean room implementation of this function
Message-ID:  <XFMail.010726154958.jhb@FreeBSD.org>
In-Reply-To: <20010726151100.D23264@sharmas.dhs.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 26-Jul-01 Arun Sharma wrote:
> On Thu, Jul 26, 2001 at 11:59:27PM +0200, Bernd Walter wrote:
>> [...]
>> ATOMIC_ASM(set,      char,  "orb %b2,%0",   v)
>> ATOMIC_ASM(clear,    char,  "andb %b2,%0", ~v)
>> [...]
> 
> That does set, not test-and-set. What I want is exactly what the Intel
> BTS instruction does: atomically test and set a bit.

Unfortunately that is very ia32 specific.  The code would be more friendly on
alpha and ia64 at least if the algo was changed to use cmpset on a word instead
of test-and-set of a bit.

If you want, I can look at the code to see where it uses test_and_set() to
determine how hard that would be.  (It might be very easy to do.)

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010726154958.jhb>