summaryrefslogtreecommitdiff
path: root/libpthread
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-11-19 10:28:47 +0100
committerNeal H. Walfield <neal@gnu.org>2008-11-19 10:28:47 +0100
commit136dc1b4e8ebb8ae08d72595a5731cd243d92fb1 (patch)
tree576889106507689512c11cae4f41fcfca105ca5e /libpthread
parentcadfdbcc0128ca382f619d52a837167c6dc20782 (diff)
Start of x86_64 port.
/ 2008-11-19 Neal H. Walfield <neal@gnu.org> * configure.ac: Rename amd64 to x86_64. Update users. binutils/ 2008-11-19 Neal H. Walfield <neal@gnu.org> * patches/00-bfd-config-bfd.patch: New file. * patches/01-ld-configure-tgt.patch: New file. * Makefrag.am (patch_files): New variable. (EXTRA_DIST): Likewise. ($(addsuffix .applied,$(patch_files))): Depend on binutils/binutils/unpack.stamp and $(patch_files). Apply patches to the source tree. (rpatch): New rule. (binutils/binutils/patch.stamp): Also depend on the applied patch files. gcc/ 2008-11-19 Neal H. Walfield <neal@gnu.org> * configury2.patch: New file. * Makefrag.am (gcc_patch_files): Add configury2.patch. (gcc/gcc.build/configure.stamp): Only add --with-arch for x86 machines. libl4/ 2008-11-19 Neal H. Walfield <neal@gnu.org> * headers.m4: Only link the header files if $ARCH is ia32. libpthread/ 2008-11-19 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/bits/memory.h: New file. * sysdeps/generic/bits/spin-lock-inline.h: Likewise. * sysdeps/generic/bits/spin-lock.h: Likewise. * headers.m4: Link sysroot/include/bits/memory.h to libpthread/sysdeps/generic/bits/memory.h, sysroot/include/bits/spin-lock.h to libpthread/sysdeps/generic/bits/spin-lock.h, and sysroot/include/bits/spin-lock-inline.h to libpthread/sysdeps/generic/bits/spin-lock-inline.h. platform/ 2008-11-19 Neal H. Walfield <neal@gnu.org> * Makefile.am (ARCH_SUBDIR) [ARCH_X86_64]: Set to x86_64. * amd64/Makefile.am: Move from here... * x86_64/Makefile.am: ... to here. * amd64/bits/atomic.h: Move from here... * x86_64/bits/atomic.h: ... to here. * amd64/bits/endian.h: Move from here... * x86_64/bits/endian.h: ... to here. * amd64/bits/wordsize.h: Move from here... * x86_64/bits/wordsize.h: ... to here. * amd64/sys/io.h: Move from here... * x86_64/sys/io.h: ... to here.
Diffstat (limited to 'libpthread')
-rw-r--r--libpthread/ChangeLog12
-rw-r--r--libpthread/headers.m46
-rw-r--r--libpthread/sysdeps/generic/bits/memory.h37
-rw-r--r--libpthread/sysdeps/generic/bits/spin-lock-inline.h94
-rw-r--r--libpthread/sysdeps/generic/bits/spin-lock.h39
5 files changed, 185 insertions, 3 deletions
diff --git a/libpthread/ChangeLog b/libpthread/ChangeLog
index 7545033..7a3f156 100644
--- a/libpthread/ChangeLog
+++ b/libpthread/ChangeLog
@@ -1,3 +1,15 @@
+2008-11-19 Neal H. Walfield <neal@gnu.org>
+
+ * sysdeps/generic/bits/memory.h: New file.
+ * sysdeps/generic/bits/spin-lock-inline.h: Likewise.
+ * sysdeps/generic/bits/spin-lock.h: Likewise.
+ * headers.m4: Link sysroot/include/bits/memory.h to
+ libpthread/sysdeps/generic/bits/memory.h,
+ sysroot/include/bits/spin-lock.h to
+ libpthread/sysdeps/generic/bits/spin-lock.h, and
+ sysroot/include/bits/spin-lock-inline.h to
+ libpthread/sysdeps/generic/bits/spin-lock-inline.h.
+
2008-11-03 Neal H. Walfield <neal@gnu.org>
* headers.m4: Don't create an empty libpthread/libpthread.a.
diff --git a/libpthread/headers.m4 b/libpthread/headers.m4
index 2289811..7c73cf2 100644
--- a/libpthread/headers.m4
+++ b/libpthread/headers.m4
@@ -14,9 +14,9 @@ AC_CONFIG_LINKS([
sysroot/include/pthread.h:libpthread/include/pthread.h
sysroot/include/pthread/pthread.h:libpthread/include/pthread/pthread.h
sysroot/include/pthread/pthreadtypes.h:libpthread/include/pthread/pthreadtypes.h
- sysroot/include/bits/memory.h:libpthread/sysdeps/${arch}/bits/memory.h
- sysroot/include/bits/spin-lock.h:libpthread/sysdeps/${arch}/bits/spin-lock.h
- sysroot/include/bits/spin-lock-inline.h:libpthread/sysdeps/${arch}/bits/spin-lock-inline.h
+ sysroot/include/bits/memory.h:libpthread/sysdeps/generic/bits/memory.h
+ sysroot/include/bits/spin-lock.h:libpthread/sysdeps/generic/bits/spin-lock.h
+ sysroot/include/bits/spin-lock-inline.h:libpthread/sysdeps/generic/bits/spin-lock-inline.h
sysroot/include/bits/barrier-attr.h:libpthread/sysdeps/generic/bits/barrier-attr.h
sysroot/include/bits/barrier.h:libpthread/sysdeps/generic/bits/barrier.h
sysroot/include/bits/cancelation.h:libpthread/sysdeps/generic/bits/cancelation.h
diff --git a/libpthread/sysdeps/generic/bits/memory.h b/libpthread/sysdeps/generic/bits/memory.h
new file mode 100644
index 0000000..cbb67f3
--- /dev/null
+++ b/libpthread/sysdeps/generic/bits/memory.h
@@ -0,0 +1,37 @@
+/* Memory barrier operations. Generic version.
+ Copyright (C) 2002, 2008 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ 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 _BITS_MEMORY_H
+#define _BITS_MEMORY_H 1
+
+/* Prevent read and write reordering across this function. */
+static inline void
+__memory_barrier (void)
+{
+ /* Any lock'ed instruction will do. */
+ __sync_synchronize ();
+}
+
+/* Prevent read reordering across this function. */
+#define __memory_read_barrier __memory_barrier
+
+/* Prevent write reordering across this function. */
+#define __memory_write_barrier __memory_barrier
+
+#endif
diff --git a/libpthread/sysdeps/generic/bits/spin-lock-inline.h b/libpthread/sysdeps/generic/bits/spin-lock-inline.h
new file mode 100644
index 0000000..119063a
--- /dev/null
+++ b/libpthread/sysdeps/generic/bits/spin-lock-inline.h
@@ -0,0 +1,94 @@
+/* Machine-specific definitions for spin locks. Generic version.
+ Copyright (C) 2000, 2005, 2008 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ 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. */
+
+/*
+ * Never include this file directly; use <pthread.h> or <cthreads.h> instead.
+ */
+
+#ifndef _BITS_SPIN_LOCK_INLINE_H
+#define _BITS_SPIN_LOCK_INLINE_H 1
+
+#include <features.h>
+#include <bits/spin-lock.h>
+
+__BEGIN_DECLS
+
+#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES
+
+# ifndef __EBUSY
+# include <errno.h>
+# define __EBUSY EBUSY
+# endif
+
+# ifndef __PT_SPIN_INLINE
+# define __PT_SPIN_INLINE __extern_inline
+# endif
+
+__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock);
+
+__PT_SPIN_INLINE int
+__pthread_spin_destroy (__pthread_spinlock_t *__lock)
+{
+ return 0;
+}
+
+__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock,
+ int __pshared);
+
+__PT_SPIN_INLINE int
+__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared)
+{
+ *__lock = __SPIN_LOCK_INITIALIZER;
+ return 0;
+}
+
+__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock);
+
+__PT_SPIN_INLINE int
+__pthread_spin_trylock (__pthread_spinlock_t *__lock)
+{
+ int __locked = __sync_val_compare_and_swap (__lock, 0, 1);
+ return __locked ? __EBUSY : 0;
+}
+
+__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock);
+extern int _pthread_spin_lock (__pthread_spinlock_t *__lock);
+
+__extern_inline int
+__pthread_spin_lock (__pthread_spinlock_t *__lock)
+{
+ if (__pthread_spin_trylock (__lock))
+ return _pthread_spin_lock (__lock);
+ return 0;
+}
+
+__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock);
+
+__PT_SPIN_INLINE int
+__pthread_spin_unlock (__pthread_spinlock_t *__lock)
+{
+ int __locked = __sync_val_compare_and_swap (__lock, 1, 0);
+ return __locked ? 0 : __EINVAL;
+}
+
+#endif /* Use extern inlines or force inlines. */
+
+__END_DECLS
+
+#endif /* bits/spin-lock.h */
diff --git a/libpthread/sysdeps/generic/bits/spin-lock.h b/libpthread/sysdeps/generic/bits/spin-lock.h
new file mode 100644
index 0000000..c2ba332
--- /dev/null
+++ b/libpthread/sysdeps/generic/bits/spin-lock.h
@@ -0,0 +1,39 @@
+/* Machine-specific definitions for spin locks. Generic version.
+ Copyright (C) 2000, 2005, 2008 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ 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. */
+
+/*
+ * Never include this file directly; use <pthread.h> or <cthreads.h> instead.
+ */
+
+#ifndef _BITS_SPIN_LOCK_H
+#define _BITS_SPIN_LOCK_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* The type of a spin lock object. */
+typedef __volatile int __pthread_spinlock_t;
+
+/* Initializer for a spin lock object. */
+# define __SPIN_LOCK_INITIALIZER ((__pthread_spinlock_t) 0)
+
+__END_DECLS
+
+#endif /* bits/spin-lock.h */