Skip to contentSkip to conversation

Fix the atomic compare and swap

PATCH John David Anglin 1 participant 1 message May 21, 2007 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

sysdeps/unix/sysv/linux/hppa/bits/atomic.h line 75

Quoted 10 lines

Then, what about this patch?

sysdeps/unix/sysv/linux/hppa/bits/atomic.h renamed from sysdeps/unix/sysv/linux/hppa/bits/atomic.h.orig +1 -0
@@ -71,10 +71,10 @@
 	"copy	%5, %%r24			\n\t"			\
 	"ble	" LWS "(%%sr2, %%r0)		\n\t"			\
 	"ldi	" LWS_CAS ", %%r20		\n\t"			\
+        "sub	%%r0, %%r21, %%r21		\n\t"			\
 	"cmpib,=,n " ASM_EAGAIN ",%%r21,0b	\n\t"			\

Hmmm, I think the original code was better since it keeps the sub instruction outside the loop. The cmpib instruction could be modified to negate the ASM_EAGAIN.

On the otherhand, I'm now thinking that macros like LWS, LWS_CAS and ASM_EAGAIN shouldn't be used as they are names that could be used in user code.

Dave

Signature · 6 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux