summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2003-01-30 08:44:40 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2003-01-30 08:44:40 +0000
commite3c44a3395f29a278f20653feb8a65a72b88013a (patch)
treef26cbd73c6f5f53b00a9842ef0a5f66dcc8204c5 /libpthread
parente454093a142e48d242eb9faf960fd2d5621677e7 (diff)
Initial checkin.
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/linuxthreads/sysdeps/v850/pt-machine.h46
-rw-r--r--libpthread/linuxthreads/sysdeps/v850/sigcontextinfo.h17
2 files changed, 63 insertions, 0 deletions
diff --git a/libpthread/linuxthreads/sysdeps/v850/pt-machine.h b/libpthread/linuxthreads/sysdeps/v850/pt-machine.h
new file mode 100644
index 000000000..a28360c58
--- /dev/null
+++ b/libpthread/linuxthreads/sysdeps/v850/pt-machine.h
@@ -0,0 +1,46 @@
+/*
+ * sysdeps/v850/pt-machine.h -- v850-specific pthread definitions
+ *
+ * Copyright (C) 2002 NEC Electronics Corporation
+ * Copyright (C) 2002 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#ifndef PT_EI
+# define PT_EI extern inline
+#endif
+
+/* Get some notion of the current stack. Need not be exactly the top
+ of the stack, just something somewhere in the current frame. */
+#define CURRENT_STACK_FRAME __stack_pointer
+register char *__stack_pointer __asm__ ("sp");
+
+#define HAS_COMPARE_AND_SWAP
+
+/* Atomically: If *PTR == OLD, set *PTR to NEW and return true,
+ otherwise do nothing and return false. */
+PT_EI int
+__compare_and_swap (long *ptr, long old, long new)
+{
+ unsigned long psw;
+
+ /* disable interrupts */
+ __asm__ __volatile__ ("stsr psw, %0; di" : "=&r" (psw));
+
+ if (likely (*ptr == old))
+ {
+ *ptr = new;
+ __asm__ __volatile__ ("ldsr %0, psw" :: "r" (psw)); /* re-enable */
+ return 1;
+ }
+ else
+ {
+ __asm__ __volatile__ ("ldsr %0, psw" :: "r" (psw)); /* re-enable */
+ return 0;
+ }
+}
diff --git a/libpthread/linuxthreads/sysdeps/v850/sigcontextinfo.h b/libpthread/linuxthreads/sysdeps/v850/sigcontextinfo.h
new file mode 100644
index 000000000..7587e9126
--- /dev/null
+++ b/libpthread/linuxthreads/sysdeps/v850/sigcontextinfo.h
@@ -0,0 +1,17 @@
+/*
+ * sysdeps/v850/sigcontextinfo.h -- v850-specific pthread signal definitions
+ *
+ * Copyright (C) 2002 NEC Electronics Corporation
+ * Copyright (C) 2002 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#include <signal.h>
+
+#define SIGCONTEXT struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS