[kaffe] [PATCH] IA-64 synchronization primitives

Gwenole Beauchesne gbeauchesne at mandrakesoft.com
Thu May 15 10:35:02 PDT 2003


Hi,

Since the IA-64 ABI defines synchronisation primitives like
__sync_bool_compare_and_swap (7.4.3), I moved COMPARE_AND_EXCHANGE macro
to common.h.

BTW, both gcc & ecc have them in <ia64intrin.h>.

2003-05-13  Gwenole Beauchesne  <gbeauchesne at mandrakesoft.com>

	* config/ia64/linux/md.h (COMPARE_AND_EXCHANGE): Move to...
	* config/ia64/common.h: ... here.

	The Intel Itanium Processor-specific ABI defines
	__sync_bool_compare_and_swap primitive (7.4.3).

--- kaffe-1.1/config/ia64/linux/md.h.ia64intrin	2003-05-15 21:51:34.000000000 +0200
+++ kaffe-1.1/config/ia64/linux/md.h	2003-05-15 23:23:32.000000000 +0200
@@ -38,20 +38,4 @@ extern void IA64_context_restore(jmp_buf
 #define GET_SIGNAL_CONTEXT_POINTER(sc)		(sc)
 #define SIGNAL_PC(scp)				((scp)->sc_ip & ~0x3ULL)
 
-#ifdef HAVE_IA64INTRIN_H
-
-#include <ia64intrin.h>
-#undef COMPARE_AND_EXCHANGE
-#define COMPARE_AND_EXCHANGE(A, O, N) \
-	__sync_bool_compare_and_swap((A), (O), (N))
-
-#else
-
-#include <asm/atomic.h>
-#undef COMPARE_AND_EXCHANGE
-#define COMPARE_AND_EXCHANGE(A, O, N) \
-	(cmpxchg((A), (O), (N)) == (O))
-		
-#endif /* HAVE_IA64INTRIN_H */
-
 #endif
--- kaffe-1.1/config/ia64/common.h.ia64intrin	2003-05-14 20:59:09.000000000 +0200
+++ kaffe-1.1/config/ia64/common.h	2003-05-15 23:26:54.000000000 +0200
@@ -19,4 +19,20 @@
 #include "sysdepCallMethod.h"
 #endif
 
+/*
+ * Do an atomic compare and exchange.  The address 'A' is checked
+ * against value 'O' and if they match it's exchanged with value 'N'.
+ * We return '1' if the exchange is sucessful, otherwise 0.
+ */
+
+#ifdef HAVE_IA64INTRIN_H
+#include <ia64intrin.h>
+#endif
+
+/* Intel Itanium Processor-specific ABI defines
+   __sync_bool_compare_and_swap primitive (7.4.3).  */
+#undef COMPARE_AND_EXCHANGE
+#define COMPARE_AND_EXCHANGE(A, O, N) \
+	__sync_bool_compare_and_swap((A), (O), (N))
+
 #endif





More information about the kaffe mailing list