Re: bitops atomicity question

Gabriel Paubert (paubert@iram.es)
Mon, 25 Aug 1997 12:50:04 +0200 (METDST)


On Mon, 25 Aug 1997, David S. Miller wrote:

> It's funny, because the m68k has one of the most advanced atomic
> operations of any processor, DCAS.

It's called CAS2 in the Motorola literature, AFAIK. And it's so advanced that
it's not implemented in the 68060 (complex and slow software emulation) :-(
However there are dual CPU 68040 and 68060 (at least VME) boards.

On the 68060 CAS must be aligned too or it's emulated, but that's a minor
detail. (CAS means compare and swap)

Matti Arnaio wrote:

> With TAS instruction you get this, also with CAS.
> The bus-lock is implicite. (They are 'Test And Set',
> and 'Compare And Set' instructions respectively.)
^^^^^^^^^^^^^^^^
Compare and Swap

> However those operate on 1/2/4 byte entities only,
> not on BITS.

Easy to make atomic bitops out of CAS: use CAS with original byte/word/long
as compare operand and modified (with cleared or set bit) value as update
operand.

Gabriel.