Subject: Re: Atomic ops API
To: Michael van Elst <mlelstv@serpens.de>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/13/2007 15:29:40
On Mar 13, 2007, at 3:04 PM, Michael van Elst wrote:

> An 68020 and higher does conventional bus cycles for TAS,CAS,CAS2
> but asserts an extra signal for an atomic operation, so you
> can use these instructions even on chip memory, again without
> any special meaning.
>
> The bus locking signal is ignored by Amiga hardware because atomic
> bus operations make only sense on systems with multiple bus masters
> (i.e.  multiple CPUs in this context) and an SMP-Amiga hasn't been
> built yet.

Ok, so, sounds like it's not an issue on m68k -- CAS can be used on  
all Amiga hardware that NetBSD supports.

> To implement mutexes you use some atomic read-modify-write
> instruction such as BSET/BCLR.

Actually, TAS is used by the m68k simple_lock implementation and CAS  
is used by the mutex implementation.  Read the big theory statement in  
kern_mutex.c

-- thorpej