Subject: CVS commit: src/sys/arch/arm/arm
To: None <source-changes@NetBSD.org>
From: Jason R Thorpe <thorpej@netbsd.org>
List: source-changes
Date: 03/09/2007 19:29:29
Module Name:	src
Committed By:	thorpej
Date:		Fri Mar  9 19:29:28 UTC 2007

Added Files:
	src/sys/arch/arm/arm: lock_cas.S

Log Message:
[Missed this file in the initial commit.]

Rewrite the ARM mutex implementation to be of the simple-mutex variety.
Because pre-v6 ARM lacks support for an atomic compare-and-swap, we
implement _lock_cas() as a restartable atomic squence that is checked
in the IRQ handler right before AST processing.  (This is safe because,
for all practical purposes, there are no SMP pre-v6 ARM systems.)

This can serve as a model for other non-MP platforms that lack the
necessary atomic operations for mutexes (SuperH, for example).

Upshots of this change:
- kmutex_t is now down to 8 bytes on ARM; about as good as we can get.
- ARM2 systems don't have to trap and emulate SWP or SWPB for mutexes.

The acorn26 port is not updated by this commit to do the LOCK_CAS_CHECK.
That is left as an exercise for the port maintainer.

Reviewed and tested by Matt Thomas.


To generate a diff of this commit:
cvs rdiff -r0 -r1.1 src/sys/arch/arm/arm/lock_cas.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.