From owner-freebsd-hackers Thu Jul 26 15:50: 9 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.wrs.com (unknown-1-11.windriver.com [147.11.1.11]) by hub.freebsd.org (Postfix) with ESMTP id 246CE37B401 for ; Thu, 26 Jul 2001 15:50:07 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: from laptop.baldwin.cx (john@[147.11.46.217]) by mail.wrs.com (8.9.3/8.9.1) with ESMTP id PAA07465; Thu, 26 Jul 2001 15:50:01 -0700 (PDT) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20010726151100.D23264@sharmas.dhs.org> Date: Thu, 26 Jul 2001 15:49:58 -0700 (PDT) From: John Baldwin To: Arun Sharma Subject: Re: Need a clean room implementation of this function Cc: hackers@FreeBSD.org, Bernd Walter Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 -- 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