Subject: vax needs atomic ops
To: None <email@example.com>
From: Andrew Doran <firstname.lastname@example.org>
Date: 11/29/2007 15:46:34
We're nearly ready with atomic ops in the kernel, however the code for vax
needs to be written. The minimum that needs to be provided is an atomic
compare and swap function and the rest can be provided by C code.
There is already and atomic compare and _set_, for the reader/writer locks
in lock_stubs.S. The description of how the CAS function should behave is
below. It needs to be known by a few different names, this is from the arm
atomic_cas_32(volatile uint32_t *ptr, uint32_t old, uint32_t new);
The atomic_cas family of functions perform a compare-and-swap operation
in an atomic fashion. The value of the variable referenced by ptr is
compared against old. If the values are equal, new is stored in the
variable referenced by ptr.
The old value of the variable referenced by ptr is always returned
regardless of whether or not the new value was stored. Applications can
test for success of the operation by comparing the return value to the
value passed as old; if they are equal then the new value was stored.