GCC built-in atomic operations and memory barriers
Toby Douglass
trd at 45mercystreet.com
Fri Nov 6 14:17:47 EST 2009
Gilles Chanteperdrix wrote:
> Russell King - ARM Linux wrote:
>> The kernel API is the syscall interface and associated data structures.
>> It does not include everything you can find in kernel headers.
>
> Are the functions found in the vectors page part of the kernel API?
> Because if that is so, then they provide a way to implement cmpxchg and
> barriers in user-space.
GCC (I had overlooked this) has a function, __sync_synchronize(), which
provides a full memory barrier. I do not know how it is implemented on
ARM, but the CAS I wrote certainly would not work (and did not work)
without a memory barrier and with this function inserted, does work.
The GCC atomic CAS for ARM appears to call the OS's compare-exchange
function, which certainly is broken, by lacking memory barriers, on the
Linux I am developing on.
Either way, I now have my own platform independent ARM __asm__ for LL/CS
CAS, with memory barriers, so I'm happy. Also, I got my OpenGL wrapper
DLL working last night :-)
More information about the linux-arm-kernel
mailing list