svn commit: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps: avr32 pthread unix/sysv/linux

kraj at uclibc.org kraj at uclibc.org
Mon Dec 15 19:07:27 UTC 2008


Author: kraj
Date: 2008-12-15 11:07:27 -0800 (Mon, 15 Dec 2008)
New Revision: 24420

Log:
Merge Linuxthreads from Trunk.


Added:
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h

Removed:
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/

Modified:
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/sigaction.c
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/execve.c
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c


Changeset:
Added: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h	                        (rev 0)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h	2008-12-15 19:07:27 UTC (rev 24420)
@@ -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 */

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/sigaction.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/sigaction.c	2008-12-15 16:09:03 UTC (rev 24419)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/sigaction.c	2008-12-15 19:07:27 UTC (rev 24420)
@@ -17,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+/* Somebody please explain what's going on here.  --vda */
+
 /* This is tricky.  GCC doesn't like #include_next in the primary
    source file and even if it did, the first #include_next is this
    exact file anyway.  */

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/execve.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/execve.c	2008-12-15 16:09:03 UTC (rev 24419)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/execve.c	2008-12-15 19:07:27 UTC (rev 24420)
@@ -22,52 +22,19 @@
 #include <sysdep.h>
 #include <alloca.h>
 #include <sys/syscall.h>
-#include <bp-checks.h>
 
-extern int __syscall_execve (const char *__unbounded file,
-			     char *__unbounded const *__unbounded argv,
-			     char *__unbounded const *__unbounded envp);
-extern void __pthread_kill_other_threads_np (void);
-weak_extern (__pthread_kill_other_threads_np)
+extern int __syscall_execve(const char *file,
+			char *const *argv,
+			char *const *envp);
+extern void __pthread_kill_other_threads_np(void);
+weak_extern(__pthread_kill_other_threads_np)
 
-
 int
-__execve (file, argv, envp)
-     const char *file;
-     char *const argv[];
-     char *const envp[];
+__execve(const char *file, char *const argv[], char *const envp[])
 {
-  /* If this is a threaded application kill all other threads.  */
-  if (__pthread_kill_other_threads_np)
-    __pthread_kill_other_threads_np ();
-#if __BOUNDED_POINTERS__
-  {
-    char *const *v;
-    int i;
-    char *__unbounded *__unbounded ubp_argv;
-    char *__unbounded *__unbounded ubp_envp;
-    char *__unbounded *__unbounded ubp_v;
-
-    for (v = argv; *v; v++)
-      ;
-    i = v - argv + 1;
-    ubp_argv = (char *__unbounded *__unbounded) alloca (sizeof (*ubp_argv) * i);
-    for (v = argv, ubp_v = ubp_argv; --i; v++, ubp_v++)
-      *ubp_v = CHECK_STRING (*v);
-    *ubp_v = 0;
-
-    for (v = envp; *v; v++)
-      ;
-    i = v - envp + 1;
-    ubp_envp = (char *__unbounded *__unbounded) alloca (sizeof (*ubp_envp) * i);
-    for (v = envp, ubp_v = ubp_envp; --i; v++, ubp_v++)
-      *ubp_v = CHECK_STRING (*v);
-    *ubp_v = 0;
-
-    return INLINE_SYSCALL (execve, 3, CHECK_STRING (file), ubp_argv, ubp_envp);
-  }
-#else
-  return INLINE_SYSCALL (execve, 3, file, argv, envp);
-#endif
+	/* If this is a threaded application kill all other threads.  */
+	if (__pthread_kill_other_threads_np)
+		__pthread_kill_other_threads_np();
+	return INLINE_SYSCALL(execve, 3, file, argv, envp);
 }
-weak_alias (__execve, execve)
+weak_alias(__execve, execve)

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c	2008-12-15 16:09:03 UTC (rev 24419)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c	2008-12-15 19:07:27 UTC (rev 24420)
@@ -23,11 +23,10 @@
 
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
-#include <bp-checks.h>
 #include <bits/libc-lock.h>
 
-extern int __syscall_rt_sigtimedwait (const sigset_t *__unbounded, siginfo_t *__unbounded,
-				      const struct timespec *__unbounded, size_t);
+extern int __syscall_rt_sigtimedwait (const sigset_t *, siginfo_t *,
+				      const struct timespec *, size_t);
 
 
 /* Return any pending signal or wait for one for the given time.  */
@@ -40,7 +39,7 @@
      real size of the user-level sigset_t.  */
 #ifdef INTERNAL_SYSCALL
   INTERNAL_SYSCALL_DECL (err);
-  ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
+  ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, set,
 			  NULL, NULL, _NSIG / 8);
   if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
     {
@@ -50,7 +49,7 @@
   else
     ret = INTERNAL_SYSCALL_ERRNO (ret, err);
 #else
-  ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
+  ret = INLINE_SYSCALL (rt_sigtimedwait, 4, set,
 			NULL, NULL, _NSIG / 8);
   if (ret != -1)
     {




More information about the uClibc-cvs mailing list