From owner-freebsd-current Tue Jan 16 19:28: 2 2001 Delivered-To: freebsd-current@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 6553737B401; Tue, 16 Jan 2001 19:27:43 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id OAA20864; Wed, 17 Jan 2001 14:27:02 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01JZ0MHXAABKGKTS96@cim.alcatel.com.au>; Wed, 17 Jan 2001 14:27:02 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.0/8.11.0) id f0H3Qs399271; Wed, 17 Jan 2001 14:26:54 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Wed, 17 Jan 2001 14:26:54 +1100 From: Peter Jeremy Subject: Re: Atomic breakage? In-reply-to: <20010116191009.E7240@fw.wintelcom.net>; from bright@wintelcom.net on Tue, Jan 16, 2001 at 07:10:10PM -0800 To: Alfred Perlstein Cc: Bruce Evans , Julian Elischer , John Baldwin , current@FreeBSD.ORG, Mark Murray Mail-followup-to: Alfred Perlstein , Bruce Evans , Julian Elischer , John Baldwin , current@FreeBSD.ORG, Mark Murray Message-id: <20010117142654.A98607@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <3A64AA23.30035A1C@elischer.org> <20010116191009.E7240@fw.wintelcom.net> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2001-Jan-16 19:10:10 -0800, Alfred Perlstein wrote: >* Bruce Evans [010116 19:03] wrote: >> These don't use atomic operations (hint: no 64-bit atomic operations are >> implemented on i386's). If they need to be atomic, then they must use >> locks. > >Just wondering, can't you use 'LOCK addl' and then use 'LOCK addc'? >add longword, add longword with carry? I know it would be pretty >ugly, but it should work, no? It's not an atomic update because each longword is being updated independently: A reader can access the object between the low word and high word being updated and see an inconsistent result. If you don't need to support multiple bus masters, then the best you can achieve is: "di; addl; adcl; ei" - you don't need the lock prefixes. To support multiple masters, you need proper locks. Since SMP isn't supported on the 80386, as long as you don't to DMA to/from 64-bit objects you can get away with the "di; addl; adcl; ei" sequence. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message