summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2007-02-23 09:43:14 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2007-02-23 09:43:14 +0000
commit2155767c84ff821099d45c8096afa043b53ef348 (patch)
tree2778bf1b05f5f676756b3913d702d44a0ee17ea8
parentcdd224186488ab9c236c5af6fba9b39f72337eac (diff)
Implemented atomic Read_and_clear for PPC64
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7905 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--byterun/signals_machdep.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/byterun/signals_machdep.h b/byterun/signals_machdep.h
index 98799807c..08c5f4cb8 100644
--- a/byterun/signals_machdep.h
+++ b/byterun/signals_machdep.h
@@ -42,6 +42,16 @@
: "r" (&(src)), "r" (0) \
: "cr0", "memory")
+#elif defined(__GNUC__) && defined(__ppc64__)
+
+#define Read_and_clear(dst,src) \
+ asm("0: ldarx %0, 0, %1\n\t" \
+ "stdcx. %2, 0, %1\n\t" \
+ "bne- 0b" \
+ : "=&r" (dst) \
+ : "r" (&(src)), "r" (0) \
+ : "cr0", "memory")
+
#else
/* Default, non-atomic implementation */