summaryrefslogtreecommitdiffstats
path: root/libpthread/linuxthreads.old/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/linuxthreads.old/sysdeps')
-rw-r--r--libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h7
-rw-r--r--libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h7
-rw-r--r--libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h73
-rw-r--r--libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h53
-rw-r--r--libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h8
-rw-r--r--libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h4
-rw-r--r--libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h6
-rw-r--r--libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h6
-rw-r--r--libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h6
-rw-r--r--libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h7
-rw-r--r--libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h12
-rw-r--r--libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h5
-rw-r--r--libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h6
-rw-r--r--libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h7
-rw-r--r--libpthread/linuxthreads.old/sysdeps/pthread/pthread.h5
-rw-r--r--libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h7
-rw-r--r--libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.h13
-rw-r--r--libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h2
-rw-r--r--libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h2
-rw-r--r--libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h8
-rw-r--r--libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h19
-rw-r--r--libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h48
22 files changed, 233 insertions, 78 deletions
diff --git a/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h
index 853ac6f04..97c38394b 100644
--- a/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h
@@ -23,8 +23,10 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
#ifdef __linux__
@@ -33,9 +35,6 @@
# include <machine/pal.h>
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* 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
diff --git a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
index 284567970..14eb6f6da 100644
--- a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
@@ -22,13 +22,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* This will not work on ARM1 or ARM2 because SWP is lacking on those
machines. Unfortunately we have no way to detect this at compile
time; let's hope nobody tries to use one. */
diff --git a/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h
new file mode 100644
index 000000000..c9669f2d3
--- /dev/null
+++ b/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h
@@ -0,0 +1,73 @@
+/* Machine-dependent pthreads configuration and inline functions.
+ *
+ * Copyright (C) 2005-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#ifndef _PT_MACHINE_H
+#define _PT_MACHINE_H 1
+
+#include <features.h>
+
+#ifndef PT_EI
+# define PT_EI __extern_always_inline
+#endif
+
+static inline int
+_test_and_set (int *p, int v)
+{
+ int result;
+
+ __asm__ __volatile__(
+ "/* Inline test and set */\n"
+ " xchg %[old], %[mem], %[new]"
+ : [old] "=&r"(result)
+ : [mem] "r"(p), [new] "r"(v)
+ : "memory");
+
+ return result;
+}
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
+/* Spinlock implementation; required. */
+PT_EI long int
+testandset (int *spinlock)
+{
+ return _test_and_set(spinlock, 1);
+}
+
+
+/* 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");
+
+/* Compare-and-swap for semaphores. */
+
+#define HAS_COMPARE_AND_SWAP
+PT_EI int
+__compare_and_swap(long int *p, long int oldval, long int newval)
+{
+ long int result;
+
+ __asm__ __volatile__(
+ "/* Inline compare and swap */\n"
+ "1: ssrf 5\n"
+ " ld.w %[result], %[mem]\n"
+ " eor %[result], %[old]\n"
+ " brne 2f\n"
+ " stcond %[mem], %[new]\n"
+ " brne 1b\n"
+ "2:"
+ : [result] "=&r"(result), [mem] "=m"(*p)
+ : "m"(*p), [new] "r"(newval), [old] "r"(oldval)
+ : "cc", "memory");
+
+ return result == 0;
+}
+
+#endif /* pt-machine.h */
diff --git a/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h
index fef16263e..9f5cb5c1f 100644
--- a/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h
@@ -21,37 +21,56 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long *, long , long);
+#include <asm/fixed_code.h>
/* Spinlock implementation; required. */
+/* The semantics of the TESTSET instruction cannot be guaranteed. We cannot
+ easily move all locks used by linux kernel to non-cacheable memory.
+ EXCPT 0x4 is used to trap into kernel to do the atomic testandset.
+ It's ugly. But it's the only thing we can do now.
+ The handler of EXCPT 0x4 expects the address of the lock is passed through
+ R0. And the result is returned by R0. */
PT_EI long int
testandset (int *spinlock)
{
- if (*spinlock)
- return 1;
- else
- {
- *spinlock=1;
- return 0;
- }
+ long int res;
+
+ __asm__ __volatile__ (
+ "CALL (%4);"
+ : "=q0" (res), "=m" (*spinlock)
+ : "qA" (spinlock), "m" (*spinlock), "a" (ATOMIC_XCHG32), "q1" (1)
+ : "RETS", "cc", "memory");
+
+ return res;
}
#define HAS_COMPARE_AND_SWAP
-
PT_EI int
__compare_and_swap (long int *p, long int oldval, long int newval)
{
- if((*p ^ oldval) == 0) {
- *p = newval;
- return 1;
- }
- else
- return 0;
+ long int readval;
+ __asm__ __volatile__ (
+ "CALL (%5);"
+ : "=q0" (readval), "=m" (*p)
+ : "qA" (p),
+ "q1" (oldval),
+ "q2" (newval),
+ "a" (ATOMIC_CAS32),
+ "m" (*p)
+ : "RETS", "memory", "cc");
+ return readval == oldval;
}
+#ifdef SHARED
+# define PTHREAD_STATIC_FN_REQUIRE(name)
+#else
+# define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " "_"#name);
+#endif
+
#endif /* pt-machine.h */
diff --git a/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h
index a287e866a..6d626fb4b 100644
--- a/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h
@@ -17,9 +17,13 @@
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifndef _PT_MACHINE_H
+#define _PT_MACHINE_H 1
+
+#include <features.h>
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
PT_EI long int
@@ -62,3 +66,5 @@ testandset (int *spinlock)
I don't trust register variables, so let's do this the safe way. */
#define CURRENT_STACK_FRAME \
({ char *sp; __asm__ ("move.d $sp,%0" : "=rm" (sp)); sp; })
+
+#endif /* pt-machine.h */
diff --git a/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h
index 64df5ffdb..2317b65a0 100644
--- a/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h
@@ -22,10 +22,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef __ASSEMBLER__
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
/* Spinlock implementation; required. */
diff --git a/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h
index ad83147cb..121f496d7 100644
--- a/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h
@@ -22,12 +22,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-
/* Spinlock implementation; required. */
PT_EI long int
testandset (int *spinlock)
diff --git a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
index af1818d7b..989641439 100644
--- a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
@@ -22,13 +22,17 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef __ASSEMBLER__
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
+/*
extern long int testandset (int *spinlock);
extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+*/
/* Get some notion of the current stack. Need not be exactly the top
of the stack, just something somewhere in the current frame. */
diff --git a/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h
index a5ffec48d..668057a2a 100644
--- a/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h
@@ -21,6 +21,7 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
#include <ia64intrin.h>
#include <sys/types.h>
@@ -28,12 +29,9 @@ extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
size_t __child_stack_size, int __flags, void *__arg, ...);
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* Make sure gcc doesn't try to be clever and move things around on
us. We need to use _exactly_ the address the user gave us, not some
alias that contains the same information. */
diff --git a/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h
index 4670ae3c4..295495baf 100644
--- a/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h
@@ -22,13 +22,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* Spinlock implementation; required. */
PT_EI long int
testandset (int *spinlock)
diff --git a/libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h
index 0bf7fc5b0..638952846 100644
--- a/libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h
@@ -26,6 +26,10 @@
#include <features.h>
+#ifndef PT_EI
+# define PT_EI __extern_always_inline
+#endif
+
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000. */
@@ -55,14 +59,6 @@ __NTH (_test_and_set (int *p, int v))
}
-#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
-#endif
-
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
-
/* Spinlock implementation; required. */
PT_EI long int
diff --git a/libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h
index 5d82b8d16..140455013 100644
--- a/libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h
@@ -22,11 +22,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
/* Spinlock implementation; required. */
/* it is weird and dangerous to disable interrupt in userspace, but for nios
what else we can do before we have a swap like instruction? This is better
diff --git a/libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h
index 484a77e14..061fa735e 100644
--- a/libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h
@@ -21,12 +21,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-
/* Spinlock implementation; required. */
PT_EI long int
testandset (int *spinlock)
diff --git a/libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h
index 9e6543a26..561f8958e 100644
--- a/libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h
@@ -24,13 +24,12 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* For multiprocessor systems, we want to ensure all memory accesses
are completed before we reset a lock. On other systems, we still
need to make sure that the compiler has flushed everything to memory. */
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
index 448636bd9..870e37fa5 100644
--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
@@ -635,6 +635,9 @@ extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
void (*__routine) (void *),
void *__arg) __THROW;
+extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
+ void (*__routine) (void *),
+ void *__arg) __THROW;
/* Remove a cleanup handler as pthread_cleanup_pop does, but also
restores the cancellation type that was in effect when the matching
@@ -645,6 +648,8 @@ extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffe
extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
int __execute) __THROW;
+extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
+ int __execute) __THROW;
#endif
diff --git a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h
index 02545e6b4..4ec87ad89 100644
--- a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h
@@ -22,14 +22,13 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef __ASSEMBLER__
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* Spinlock implementation; required. */
PT_EI long int
testandset (int *spinlock)
diff --git a/libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.h
index 8269a4cb3..b87448a75 100644
--- a/libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.h
@@ -22,15 +22,18 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef PT_EI
-# define PT_EI extern inline
-#endif
+#ifndef _PT_MACHINE_H
+#define _PT_MACHINE_H 1
-/* Spinlock implementation; required. */
-extern long int testandset (int *spinlock);
+#include <features.h>
+#ifndef PT_EI
+# define PT_EI __extern_always_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__ ("r15");
+
+#endif /* pt-machine.h */
diff --git a/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h
index 322a52051..43c05f2a6 100644
--- a/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h
@@ -23,7 +23,7 @@
#define _PT_MACHINE_H 1
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
extern long int testandset (int *spinlock);
diff --git a/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h
index f65c13be1..815d70e8d 100644
--- a/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h
@@ -23,7 +23,7 @@
#define _PT_MACHINE_H 1
#ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
#endif
extern long int testandset (int *spinlock);
diff --git a/libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h
index fb41c41e9..34de63b9f 100644
--- a/libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h
@@ -11,8 +11,13 @@
* Written by Miles Bader <miles@gnu.org>
*/
+#ifndef _PT_MACHINE_H
+#define _PT_MACHINE_H 1
+
+#include <features.h>
+
#ifndef PT_EI
-# define PT_EI extern inline
+# define PT_EI __extern_always_inline
#endif
/* Get some notion of the current stack. Need not be exactly the top
@@ -44,3 +49,4 @@ __compare_and_swap (long *ptr, long old, long new)
return 0;
}
}
+#endif /* pt-machine.h */
diff --git a/libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h
index 8a2d1a762..ce07bbb03 100644
--- a/libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h
+++ b/libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h
@@ -21,6 +21,8 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1
+#include <features.h>
+
#ifndef __ASSEMBLER__
# include <stddef.h> /* For offsetof. */
# include <stdlib.h> /* For abort(). */
@@ -28,12 +30,9 @@
# ifndef PT_EI
-# define PT_EI extern inline __attribute__ ((always_inline))
+# define PT_EI __extern_always_inline
# endif
-extern long int testandset (int *spinlock);
-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-
/* 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
@@ -42,14 +41,14 @@ register char * stack_pointer __asm__ ("%rsp") __attribute_used__;
/* Spinlock implementation; required. */
PT_EI long int
-testandset (int *spinlock)
+testandset (int *__spinlock)
{
long int ret;
__asm__ __volatile__ (
"xchgl %k0, %1"
- : "=r"(ret), "=m"(*spinlock)
- : "0"(1), "m"(*spinlock)
+ : "=r"(ret), "=m"(*__spinlock)
+ : "0"(1), "m"(*__spinlock)
: "memory");
return ret;
@@ -60,14 +59,14 @@ testandset (int *spinlock)
# define HAS_COMPARE_AND_SWAP
PT_EI int
-__compare_and_swap (long int *p, long int oldval, long int newval)
+__compare_and_swap (long int *__p, long int __oldval, long int __newval)
{
char ret;
long int readval;
__asm__ __volatile__ ("lock; cmpxchgq %3, %1; sete %0"
- : "=q" (ret), "=m" (*p), "=a" (readval)
- : "r" (newval), "m" (*p), "a" (oldval)
+ : "=q" (ret), "=m" (*__p), "=a" (readval)
+ : "r" (__newval), "m" (*__p), "a" (__oldval)
: "memory");
return ret;
}
diff --git a/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h
new file mode 100644
index 000000000..acd4d109f
--- /dev/null
+++ b/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h
@@ -0,0 +1,48 @@
+/* Machine-dependent pthreads configuration and inline functions.
+ Xtensa version.
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#ifndef _PT_MACHINE_H
+#define _PT_MACHINE_H 1
+
+#include <sys/syscall.h>
+#include <asm/unistd.h>
+
+#ifndef PT_EI
+# define PT_EI __extern_always_inline
+#endif
+
+/* Memory barrier. */
+#define MEMORY_BARRIER() __asm__ ("memw" : : : "memory")
+
+/* Spinlock implementation; required. */
+PT_EI long int
+testandset (int *spinlock)
+{
+ int unused = 0;
+ return INTERNAL_SYSCALL (xtensa, , 4, SYS_XTENSA_ATOMIC_SET,
+ spinlock, 1, unused);
+}
+
+/* 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 __builtin_frame_address (0)
+
+#endif /* _PT_MACHINE_H */