This may not be the best place to ask, but... Is it possible to emulate the i386 cmpxchg instruction on HPPA? From what I gather from the manuals the only atomic op on HPPA is ldcw which I have yet to figure out a way to bend to my will. Any ideas? NB: cmpxchg compares two numbers, and if they are the same overwrites one of the numbers with a third number atomically.