So the following attached is what I started playing around with this weekend. It implements software trap "0x23" to perform a CAS operations, the operands are expected in registers %o0, %o1, and %o2. Since it was easiest to test I implemented this first on sparc64 which just executes the CAS instruction directly. I'll start working on the 32-bit part in the background. The capability will be advertised via the mask returned by the "get kernel features" system call. We could check this early in the crt'ish code and cache the value in a variable which the atomics can check. Another kernel side change I have to do is advertise the LEON CAS availability in the _dl_hwcaps so that we can use the LEON CAS in glibc when available. The first patch is the kernel side, and the second is the glibc side. The whole NPTL testsuite passes for the plain 32-bit sparc target with these changes.