From 6a8ccc95528f5e86a8770ed15ce89609b5b3dee9 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 18 May 2016 18:41:24 +0200 Subject: remove linuxthreads.new, rename linuxthreads.old Linuxthreads.new isn't really useful with the existence of NPTL/TLS for well supported architectures. There is no reason to use LT.new for ARM/MIPS or other architectures supporting NPTL/TLS. It is not available for noMMU architectures like Blackfin or FR-V. To simplify the live of the few uClibc-ng developers, LT.new is removed and LT.old is renamed to LT. LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS --- .../linuxthreads.old/sysdeps/alpha/pt-machine.h | 126 ---- .../linuxthreads.old/sysdeps/arc/pt-machine.h | 42 -- .../linuxthreads.old/sysdeps/arm/pt-machine.h | 109 ---- .../linuxthreads.old/sysdeps/avr32/pt-machine.h | 73 --- .../linuxthreads.old/sysdeps/bfin/pt-machine.h | 75 --- .../linuxthreads.old/sysdeps/c6x/pt-machine.h | 63 -- .../linuxthreads.old/sysdeps/cris/pt-machine.h | 69 -- .../linuxthreads.old/sysdeps/frv/pt-machine.h | 69 -- .../linuxthreads.old/sysdeps/h8300/pt-machine.h | 57 -- .../linuxthreads.old/sysdeps/hppa/pspinlock.c | 80 --- .../linuxthreads.old/sysdeps/hppa/pt-machine.h | 59 -- .../linuxthreads.old/sysdeps/i386/pt-machine.h | 146 ----- libpthread/linuxthreads.old/sysdeps/i386/tls.h | 184 ------ libpthread/linuxthreads.old/sysdeps/i386/useldt.h | 306 --------- .../linuxthreads.old/sysdeps/ia64/pt-machine.h | 134 ---- libpthread/linuxthreads.old/sysdeps/ia64/tls.h | 138 ---- .../linuxthreads.old/sysdeps/m68k/pt-machine.h | 74 --- .../sysdeps/microblaze/pt-machine.h | 106 --- .../sysdeps/microblaze/sigcontextinfo.h | 17 - .../linuxthreads.old/sysdeps/mips/pt-machine.h | 105 --- .../linuxthreads.old/sysdeps/nios2/pt-machine.h | 57 -- .../linuxthreads.old/sysdeps/or1k/pt-machine.h | 54 -- .../linuxthreads.old/sysdeps/powerpc/pt-machine.h | 101 --- .../sysdeps/pthread/bits/libc-lock.h | 415 ------------ .../sysdeps/pthread/bits/libc-tsd.h | 69 -- .../sysdeps/pthread/bits/pthreadtypes.h | 145 ----- .../linuxthreads.old/sysdeps/pthread/not-cancel.h | 113 ---- .../sysdeps/pthread/pthread-functions.h | 113 ---- .../linuxthreads.old/sysdeps/pthread/pthread.h | 725 --------------------- libpthread/linuxthreads.old/sysdeps/pthread/tls.h | 80 --- .../linuxthreads.old/sysdeps/sh/pt-machine.h | 81 --- libpthread/linuxthreads.old/sysdeps/sh/tls.h | 116 ---- .../linuxthreads.old/sysdeps/sparc/pt-machine.h | 82 --- .../linuxthreads.old/sysdeps/sparc/tcb-offsets.h | 1 - .../linuxthreads.old/sysdeps/x86_64/pt-machine.h | 87 --- libpthread/linuxthreads.old/sysdeps/x86_64/tls.h | 133 ---- .../linuxthreads.old/sysdeps/xtensa/pt-machine.h | 79 --- 37 files changed, 4483 deletions(-) delete mode 100644 libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/hppa/pspinlock.c delete mode 100644 libpthread/linuxthreads.old/sysdeps/hppa/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/i386/tls.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/i386/useldt.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/ia64/tls.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/microblaze/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/microblaze/sigcontextinfo.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/or1k/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/bits/pthreadtypes.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/not-cancel.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/pthread.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/tls.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/sh/tls.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/tcb-offsets.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/x86_64/tls.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h (limited to 'libpthread/linuxthreads.old/sysdeps') diff --git a/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h deleted file mode 100644 index b47343ba7..000000000 --- a/libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - Alpha version. - Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If not, - see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -#ifdef __linux__ -# include -#else -# include -#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__("$30"); - - -/* Memory barrier; default is to do nothing */ -#define MEMORY_BARRIER() __asm__ __volatile__("mb" : : : "memory") -/* Write barrier. */ -#define WRITE_MEMORY_BARRIER() __asm__ __volatile__("wmb" : : : "memory") - - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - long int ret, temp; - - __asm__ __volatile__( - "/* Inline spinlock test & set */\n" - "1:\t" - "ldl_l %0,%3\n\t" - "bne %0,2f\n\t" - "or $31,1,%1\n\t" - "stl_c %1,%2\n\t" - "beq %1,1b\n" - "2:\tmb\n" - "/* End spinlock test & set */" - : "=&r"(ret), "=&r"(temp), "=m"(*spinlock) - : "m"(*spinlock) - : "memory"); - - return ret; -} - - -/* Begin allocating thread stacks at this address. Default is to allocate - them just below the initial program stack. */ -#define THREAD_STACK_START_ADDRESS 0x40000000000 - - -/* Return the thread descriptor for the current thread. */ -#define THREAD_SELF \ -({ \ - register pthread_descr __self __asm__("$0"); \ - __asm__ ("call_pal %1" : "=r"(__self) : "i"(PAL_rduniq)); \ - __self; \ -}) - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) \ -{ \ - register pthread_descr __self __asm__("$16") = (descr); \ - __asm__ __volatile__ ("call_pal %1" : : "r"(__self), "i"(PAL_wruniq)); \ -} - - -/* 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 ret; - - __asm__ __volatile__ ( - "/* Inline compare & swap */\n" - "1:\t" - "ldq_l %0,%4\n\t" - "cmpeq %0,%2,%0\n\t" - "beq %0,2f\n\t" - "mov %3,%0\n\t" - "stq_c %0,%1\n\t" - "beq %0,1b\n\t" - "2:\tmb\n" - "/* End compare & swap */" - : "=&r"(ret), "=m"(*p) - : "r"(oldval), "r"(newval), "m"(*p) - : "memory"); - - return ret; -} - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 32*1024*1024 - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h deleted file mode 100644 index 8df1e77e3..000000000 --- a/libpthread/linuxthreads.old/sysdeps/arc/pt-machine.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) - * - * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. - */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 -#include - -#ifndef PT_EI -# 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); - -PT_EI long int -testandset (int *spinlock) -{ - unsigned int old = 1; - - /* Atomically exchange @spinlock with 1 */ - __asm__ __volatile__( - "ex %0, [%1]" - : "+r" (old) - : "r" (spinlock) - : "memory"); - - return old; - -} - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. - I don't trust register variables, so let's do this the safe way. */ -#define CURRENT_STACK_FRAME \ -__extension__ ({ char *__sp; __asm__ ("mov %0,sp" : "=r" (__sp)); __sp; }) - -#else -#error PT_MACHINE already defined -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h deleted file mode 100644 index fc17e9bc7..000000000 --- a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - ARM version. - Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Philip Blundell . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include -#include - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -#if defined(__thumb2__) -PT_EI long int ldrex(int *spinlock) -{ - long int ret; - __asm__ __volatile__( - "ldrex %0, [%1]\n" - : "=r"(ret) - : "r"(spinlock) : "memory"); - return ret; -} - -PT_EI long int strex(int val, int *spinlock) -{ - long int ret; - __asm__ __volatile__( - "strex %0, %1, [%2]\n" - : "=r"(ret) - : "r" (val), "r"(spinlock) : "memory"); - return ret; -} - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - register unsigned int ret; - - do { - ret = ldrex(spinlock); - } while (strex(1, spinlock)); - - return ret; -} - -#elif defined(__thumb__) - -/* 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. */ - -/* Spinlock implementation; required. */ -PT_EI long int testandset (int *spinlock); -PT_EI long int testandset (int *spinlock) -{ - register unsigned int ret; - void *pc; - __asm__ __volatile__( - ".align 0\n" - "\tbx pc\n" - "\tnop\n" - "\t.arm\n" - "\tswp %0, %2, [%3]\n" - "\torr %1, pc, #1\n" - "\tbx %1\n" - "\t.force_thumb" - : "=r"(ret), "=r"(pc) - : "0"(1), "r"(spinlock)); - return ret; -} - -#else /* __thumb__ */ - -PT_EI long int testandset (int *spinlock); -PT_EI long int testandset (int *spinlock) -{ - register unsigned int ret; - __asm__ __volatile__("swp %0, %1, [%2]" - : "=r"(ret) - : "0"(1), "r"(spinlock)); - return ret; -} -#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"); - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h deleted file mode 100644 index 5735d0ea2..000000000 --- a/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 912d64b2c..000000000 --- a/libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -#include - -/* 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) -{ - 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) -{ - 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/c6x/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h deleted file mode 100644 index 5e8bfca56..000000000 --- a/libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - C6x version. - Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Aurelien Jacquiot . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#ifndef PT_EI -# define PT_EI extern inline -#endif - -extern int __compare_and_swap (long int *p, long int oldval, long int newval); - -/* Spinlock implementation; required. */ -static inline long int -testandset (int *spinlock) -{ - register unsigned int ret = 1; - int dummy; - __asm__ __volatile__ ("mvc .s2 CSR, %0\n\tand .s2 -2, %0, %0\n\tmvc .s2 %0, CSR\n" - : "=b" (dummy)); - - if (*spinlock == 0) { - *spinlock = 1; - ret = 0; - } - __asm__ __volatile__ ("mvc .s2 CSR, %0\n\tor .s2 1, %0, %0\n\tmvc .s2 %0, CSR\n" - : "=b" (dummy)); - return ret; -} - -#define WRITE_MEMORY_BARRIER() -#define READ_MEMORY_BARRIER() - -/* 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 get_stack_pointer() -static inline char * get_stack_pointer(void) -{ - char *sp; - __asm__ __volatile__ ("mv .d2 B15, %0" : "=b" (sp)); - return sp; -} - -#define THREAD_STACK_OFFSET 8 - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h deleted file mode 100644 index a89579ee0..000000000 --- a/libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - CRIS version. - Copyright (C) 2001, 2002, 2003 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; see the file COPYING.LIB. If not, - see . */ -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -PT_EI long int -testandset (int *spinlock) -{ - register unsigned long int ret; - - /* Note the use of a dummy output of *spinlock to expose the write. The - memory barrier is to stop *other* writes being moved past this code. */ - -#ifdef __arch_v32 - __asm__ __volatile__("clearf p\n" - "0:\n\t" - "movu.b [%2],%0\n\t" - "ax\n\t" - "move.b %3,[%2]\n\t" - "bcs 0b\n\t" - "clearf p" - : "=&r" (ret), "=m" (*spinlock) - : "r" (spinlock), "r" ((int) 1), "m" (*spinlock) - : "memory"); -#else /* not __arch_v32 */ - __asm__ __volatile__("clearf\n" - "0:\n\t" - "movu.b [%2],%0\n\t" - "ax\n\t" - "move.b %3,[%2]\n\t" - "bwf 0b\n\t" - "clearf" - : "=&r" (ret), "=m" (*spinlock) - : "r" (spinlock), "r" ((int) 1), "m" (*spinlock) - : "memory"); -#endif /* __arch_v32 */ - return ret; -} - - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. - 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 deleted file mode 100644 index 6f867ade7..000000000 --- a/libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - FR-V version. - Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Alexandre Oliva - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include - -#ifndef __ASSEMBLER__ - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int i = 1; - __asm__ ("swap%I0 %M0, %1" : "+m"(*(volatile int *)spinlock), "+r"(i)); - return i; -} - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* This symbol is defined by the ABI as the stack size requested by - the main program. */ -extern char __stacksize; -#define ARCH_STACK_MAX_SIZE ((unsigned long)&__stacksize) - -/* Memory barrier; default is to do nothing */ -#define MEMORY_BARRIER() __asm__ __volatile__("membar" : : : "memory") -/* Write barrier. */ -#define WRITE_MEMORY_BARRIER() __asm__ __volatile__("membar" : : : "memory") - -/* Return the thread descriptor for the current thread. */ -register struct _pthread_descr_struct *THREAD_SELF __asm__ ("gr29"); -#define THREAD_SELF THREAD_SELF - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) \ - (THREAD_SELF = descr) - -/* 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"); - -#endif - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h deleted file mode 100644 index a37384de9..000000000 --- a/libpthread/linuxthreads.old/sysdeps/h8300/pt-machine.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - H8/300 version. - Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - char ret; - - __asm__ __volatile__( - "sub.w %0,%0\n\t" - "stc ccr,@-sp\n\t" - "orc #0x80,ccr\n\t" - "bld #0,@%2\n\t" - "bset #0,@%2\n\t" - "rotxl.w %0\n\t" - "ldc @sp+,ccr\n\t" - :"=r"(ret),"=m"(*spinlock) - :"g"(spinlock) - :"cc"); - - return ret; -} - - -/* 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"); - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/hppa/pspinlock.c b/libpthread/linuxthreads.old/sysdeps/hppa/pspinlock.c deleted file mode 100644 index 1a6aa64a9..000000000 --- a/libpthread/linuxthreads.old/sysdeps/hppa/pspinlock.c +++ /dev/null @@ -1,80 +0,0 @@ -/* POSIX spinlock implementation. hppa version. - Copyright (C) 2000 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; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include "internals.h" - -int -__pthread_spin_lock (pthread_spinlock_t *lock) -{ - unsigned int val; - - do - __asm__ __volatile__ ("ldcw %1,%0" - : "=r" (val), "=m" (*lock) - : "m" (*lock)); - while (!val); - - return 0; -} -weak_alias (__pthread_spin_lock, pthread_spin_lock) - - -int -__pthread_spin_trylock (pthread_spinlock_t *lock) -{ - unsigned int val; - - __asm__ __volatile__ ("ldcw %1,%0" - : "=r" (val), "=m" (*lock) - : "m" (*lock)); - - return val ? 0 : EBUSY; -} -weak_alias (__pthread_spin_trylock, pthread_spin_trylock) - - -int -__pthread_spin_unlock (pthread_spinlock_t *lock) -{ - *lock = 1; - return 0; -} -weak_alias (__pthread_spin_unlock, pthread_spin_unlock) - - -int -__pthread_spin_init (pthread_spinlock_t *lock, int pshared) -{ - /* We can ignore the `pshared' parameter. Since we are busy-waiting - all processes which can access the memory location `lock' points - to can use the spinlock. */ - *lock = 1; - return 0; -} -weak_alias (__pthread_spin_init, pthread_spin_init) - - -int -__pthread_spin_destroy (pthread_spinlock_t *lock) -{ - /* Nothing to do. */ - return 0; -} -weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/libpthread/linuxthreads.old/sysdeps/hppa/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/hppa/pt-machine.h deleted file mode 100644 index 85c453c77..000000000 --- a/libpthread/linuxthreads.old/sysdeps/hppa/pt-machine.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - hppa version. - Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include -#include - -#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__ ("%r30"); - - -/* The hppa only has one atomic read and modify memory operation, - load and clear, so hppa spinlocks must use zero to signify that - someone is holding the lock. */ - -#define xstr(s) str(s) -#define str(s) #s -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__( - "ldcw 0(%2),%0" - : "=r"(ret), "=m"(*spinlock) - : "r"(spinlock)); - - return ret == 0; -} -#undef str -#undef xstr - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h deleted file mode 100644 index 24c5e6c7c..000000000 --- a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h +++ /dev/null @@ -1,146 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - i386 version. - Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include - -#ifndef __ASSEMBLER__ -#ifndef PT_EI -# define PT_EI __extern_always_inline __attribute__((visibility("hidden"))) -#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 __builtin_frame_address (0) - - -/* See if we can optimize for newer cpus... */ -#if defined __GNUC__ && __GNUC__ >= 2 && \ - (defined __i486__ || defined __pentium__ || defined __pentiumpro__ || defined __pentium4__ || \ - defined __athlon__ || defined __k8__) - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - long int ret; - - __asm__ __volatile__ ( - "xchgl %0, %1" - : "=r" (ret), "=m" (*spinlock) - : "0" (1), "m" (*spinlock) - : "memory"); - - return ret; -} - -/* Compare-and-swap for semaphores. It's always available on i686. */ -#define HAS_COMPARE_AND_SWAP - -PT_EI int -__compare_and_swap (long int *p, long int oldval, long int newval) -{ - char ret; - long int readval; - - __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" - : "=q" (ret), "=m" (*p), "=a" (readval) - : "r" (newval), "m" (*p), "a" (oldval) - : "memory"); - return ret; -} - -#if defined(__ASSUME_LDT_WORKS) && __ASSUME_LDT_WORKS > 0 -#include "useldt.h" -#endif - -/* The P4 and above really want some help to prevent overheating. */ -#define BUSY_WAIT_NOP __asm__ ("rep; nop") - - -#else /* Generic i386 implementation */ - -extern int compare_and_swap_is_available (void); - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - long int ret; - - __asm__ __volatile__( - "xchgl %0, %1" - : "=r"(ret), "=m"(*spinlock) - : "0"(1), "m"(*spinlock) - : "memory"); - - return ret; -} - - -/* Compare-and-swap for semaphores. - Available on the 486 and above, but not on the 386. - We test dynamically whether it's available or not. */ - -#define HAS_COMPARE_AND_SWAP -#define TEST_FOR_COMPARE_AND_SWAP - -PT_EI int -__compare_and_swap (long int *p, long int oldval, long int newval) -{ - char ret; - long int readval; - - __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" - : "=q" (ret), "=m" (*p), "=a" (readval) - : "r" (newval), "m" (*p), "a" (oldval) - : "memory"); - return ret; -} - -PT_EI int -compare_and_swap_is_available (void) -{ - int changed; - int oldflags; - /* get EFLAGS */ - __asm__ __volatile__ ("pushfl; popl %0" : "=r" (oldflags) : ); - /* Flip AC bit in EFLAGS. */ - __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags ^ 0x40000) : "cc"); - /* reread EFLAGS */ - __asm__ __volatile__ ("pushfl; popl %0" : "=r" (changed) : ); - /* See if bit changed. */ - changed = (changed ^ oldflags) & 0x40000; - /* Restore EFLAGS. */ - __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags) : "cc"); - /* If the AC flag did not change, it's a 386 and it lacks cmpxchg. - Otherwise, it's a 486 or above and it has cmpxchg. */ - return changed != 0; -} -#endif /* Generic i386 implementation */ - -#endif /* __ASSEMBLER__ */ - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/i386/tls.h b/libpthread/linuxthreads.old/sysdeps/i386/tls.h deleted file mode 100644 index 4469f0776..000000000 --- a/libpthread/linuxthreads.old/sysdeps/i386/tls.h +++ /dev/null @@ -1,184 +0,0 @@ -/* Definition for thread-local data handling. linuxthreads/i386 version. - Copyright (C) 2002, 2003, 2004, 2005 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, see - . */ - -#ifndef _TLS_H -#define _TLS_H - -# include - -#ifndef __ASSEMBLER__ -# include -# include -# include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - void *pointer; -} dtv_t; - - -typedef struct -{ - void *tcb; /* Pointer to the TCB. Not necessary the - thread descriptor used by libpthread. */ - dtv_t *dtv; - void *self; /* Pointer to the thread descriptor. */ -} tcbhead_t; -#endif - - -/* We can support TLS only if the floating-stack support is available. */ -#if defined FLOATING_STACKS && defined HAVE_TLS_SUPPORT - -/* Signal that TLS support is available. */ -//# define USE_TLS 1 - -# ifndef __ASSEMBLER__ -/* Get system call information. */ -# include - - -/* Get the thread descriptor definition. */ -# include - -/* This is the size of the initial TCB. */ -# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) - -/* Alignment requirements for the initial TCB. */ -# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t) - -/* This is the size of the TCB. */ -# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct) - -/* Alignment requirements for the TCB. */ -# define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct) - -/* The TCB can have any size and the memory following the address the - thread pointer points to is unspecified. Allocate the TCB there. */ -# define TLS_TCB_AT_TP 1 - - -/* Install the dtv pointer. The pointer passed is to the element with - index -1 which contain the length. */ -# define INSTALL_DTV(descr, dtvp) \ - ((tcbhead_t *) (descr))->dtv = (dtvp) + 1 - -/* Install new dtv for current thread. */ -# define INSTALL_NEW_DTV(dtv) \ - ({ struct _pthread_descr_struct *__descr; \ - THREAD_SETMEM (__descr, p_header.data.dtvp, (dtv)); }) - -/* Return dtv of given thread descriptor. */ -# define GET_DTV(descr) \ - (((tcbhead_t *) (descr))->dtv) - -# ifdef __PIC__ -# define TLS_EBX_ARG "r" -# define TLS_LOAD_EBX "xchgl %3, %%ebx\n\t" -# else -# define TLS_EBX_ARG "b" -# define TLS_LOAD_EBX -# endif - -# define TLS_DO_MODIFY_LDT(descr, nr) \ -({ \ - struct modify_ldt_ldt_s ldt_entry = \ - { nr, (unsigned long int) (descr), 0xfffff /* 4GB in pages */, \ - 1, 0, 0, 1, 0, 1, 0 }; \ - int result; \ - __asm__ __volatile__ (TLS_LOAD_EBX \ - "int $0x80\n\t" \ - TLS_LOAD_EBX \ - : "=a" (result) \ - : "0" (__NR_modify_ldt), \ - /* The extra argument with the "m" constraint is necessary \ - to let the compiler know that we are accessing LDT_ENTRY \ - here. */ \ - "m" (ldt_entry), TLS_EBX_ARG (1), "c" (&ldt_entry), \ - "d" (sizeof (ldt_entry))); \ - __builtin_expect (result, 0) != 0 ? -1 : nr * 8 + 7; \ -}) - -# define TLS_DO_SET_THREAD_AREA(descr, secondcall) \ -({ \ - struct modify_ldt_ldt_s ldt_entry = \ - { -1, (unsigned long int) (descr), 0xfffff /* 4GB in pages */, \ - 1, 0, 0, 1, 0, 1, 0 }; \ - int result; \ - if (secondcall) \ - ldt_entry.entry_number = ({ int _gs; \ - __asm__ ("movw %%gs, %w0" : "=q" (_gs)); \ - (_gs & 0xffff) >> 3; }); \ - __asm__ __volatile__ (TLS_LOAD_EBX \ - "int $0x80\n\t" \ - TLS_LOAD_EBX \ - : "=a" (result), "=m" (ldt_entry.entry_number) \ - : "0" (__NR_set_thread_area), \ - /* The extra argument with the "m" constraint is necessary \ - to let the compiler know that we are accessing LDT_ENTRY \ - here. */ \ - TLS_EBX_ARG (&ldt_entry), "m" (ldt_entry)); \ - __builtin_expect (result, 0) == 0 ? ldt_entry.entry_number * 8 + 3 : -1; \ -}) - -# ifdef __ASSUME_SET_THREAD_AREA_SYSCALL -# define TLS_SETUP_GS_SEGMENT(descr, secondcall) \ - TLS_DO_SET_THREAD_AREA (descr, firstcall) -# elif defined __NR_set_thread_area -# define TLS_SETUP_GS_SEGMENT(descr, secondcall) \ - ({ int __seg = TLS_DO_SET_THREAD_AREA (descr, secondcall); \ - __seg == -1 ? TLS_DO_MODIFY_LDT (descr, 0) : __seg; }) -# else -# define TLS_SETUP_GS_SEGMENT(descr, secondcall) \ - TLS_DO_MODIFY_LDT ((descr), 0) -# endif - -/* Code to initially initialize the thread pointer. This might need - special attention since 'errno' is not yet available and if the - operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(descr, secondcall) \ - ({ \ - void *_descr = (descr); \ - tcbhead_t *head = _descr; \ - int __gs; \ - \ - head->tcb = _descr; \ - /* For now the thread descriptor is at the same address. */ \ - head->self = _descr; \ - \ - __gs = TLS_SETUP_GS_SEGMENT (_descr, secondcall); \ - if (__builtin_expect (__gs, 7) != -1) \ - { \ - __asm__ ("movw %w0, %%gs" : : "q" (__gs)); \ - __gs = 0; \ - } \ - __gs; \ - }) - - -/* Return the address of the dtv for the current thread. */ -# define THREAD_DTV() \ - ({ struct _pthread_descr_struct *__descr; \ - THREAD_GETMEM (__descr, p_header.data.dtvp); }) - -# endif /* FLOATING_STACKS && HAVE_TLS_SUPPORT */ -#endif /* __ASSEMBLER__ */ - -#endif /* tls.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/i386/useldt.h b/libpthread/linuxthreads.old/sysdeps/i386/useldt.h deleted file mode 100644 index 02326729a..000000000 --- a/libpthread/linuxthreads.old/sysdeps/i386/useldt.h +++ /dev/null @@ -1,306 +0,0 @@ -/* Special definitions for ix86 machine using segment register based - thread descriptor. - Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper . - - 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; see the file COPYING.LIB. If not, - see . */ - -#ifndef __ASSEMBLER__ -#include /* For offsetof. */ -#include /* For abort(). */ - - -/* We don't want to include the kernel header. So duplicate the - information. */ - -/* Structure passed on `modify_ldt' call. */ -struct modify_ldt_ldt_s -{ - unsigned int entry_number; - unsigned long int base_addr; - unsigned int limit; - unsigned int seg_32bit:1; - unsigned int contents:2; - unsigned int read_exec_only:1; - unsigned int limit_in_pages:1; - unsigned int seg_not_present:1; - unsigned int useable:1; - unsigned int empty:25; -}; - -/* System call to set LDT entry. */ -extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); - - -/* Return the thread descriptor for the current thread. - - The contained asm must *not* be marked volatile since otherwise - assignments like - pthread_descr self = thread_self(); - do not get optimized away. */ -#define THREAD_SELF \ -({ \ - register pthread_descr __self; \ - __asm__ ("movl %%gs:%c1,%0" : "=r" (__self) \ - : "i" (offsetof (struct _pthread_descr_struct, \ - p_header.data.self))); \ - __self; \ -}) - - -/* Initialize the thread-unique value. Two possible ways to do it. */ - -#define DO_MODIFY_LDT(descr, nr) \ -({ \ - struct modify_ldt_ldt_s ldt_entry = \ - { nr, (unsigned long int) (descr), 0xfffff /* 4GB in pages */, \ - 1, 0, 0, 1, 0, 1, 0 }; \ - if (__modify_ldt (1, &ldt_entry, sizeof (ldt_entry)) != 0) \ - abort (); \ - __asm__ ("movw %w0, %%gs" : : "q" (nr * 8 + 7)); \ -}) - -#ifdef __PIC__ -# define USETLS_EBX_ARG "r" -# define USETLS_LOAD_EBX "xchgl %3, %%ebx\n\t" -#else -# define USETLS_EBX_ARG "b" -# define USETLS_LOAD_EBX -#endif - -/* When using the new set_thread_area call, we don't need to change %gs - because we inherited the value set up in the main thread by TLS setup. - We need to extract that value and set up the same segment in this - thread. */ -#if USE_TLS -# define DO_SET_THREAD_AREA_REUSE(nr) 1 -#else -/* Without TLS, we do the initialization of the main thread, where NR == 0. */ -# define DO_SET_THREAD_AREA_REUSE(nr) (!__builtin_constant_p (nr) || (nr)) -#endif -#define DO_SET_THREAD_AREA(descr, nr) \ -({ \ - int __gs; \ - if (DO_SET_THREAD_AREA_REUSE (nr)) \ - { \ - __asm__ ("movw %%gs, %w0" : "=q" (__gs)); \ - struct modify_ldt_ldt_s ldt_entry = \ - { (__gs & 0xffff) >> 3, \ - (unsigned long int) (descr), 0xfffff /* 4GB in pages */, \ - 1, 0, 0, 1, 0, 1, 0 }; \ - \ - int __result; \ - __asm__ (USETLS_LOAD_EBX \ - "movl %2, %%eax\n\t" \ - "int $0x80\n\t" \ - USETLS_LOAD_EBX \ - : "&a" (__result) \ - : USETLS_EBX_ARG (&ldt_entry), "i" (__NR_set_thread_area)); \ - if (__result == 0) \ - __asm__ ("movw %w0, %%gs" :: "q" (__gs)); \ - else \ - __gs = -1; \ - } \ - else \ - { \ - struct modify_ldt_ldt_s ldt_entry = \ - { -1, \ - (unsigned long int) (descr), 0xfffff /* 4GB in pages */, \ - 1, 0, 0, 1, 0, 1, 0 }; \ - int __result; \ - __asm__ (USETLS_LOAD_EBX \ - "movl %2, %%eax\n\t" \ - "int $0x80\n\t" \ - USETLS_LOAD_EBX \ - : "&a" (__result) \ - : USETLS_EBX_ARG (&ldt_entry), "i" (__NR_set_thread_area)); \ - if (__result == 0) \ - { \ - __gs = (ldt_entry.entry_number << 3) + 3; \ - __asm__ ("movw %w0, %%gs" : : "q" (__gs)); \ - } \ - else \ - __gs = -1; \ - } \ - __gs; \ -}) - -#if defined __ASSUME_SET_THREAD_AREA_SYSCALL -# define INIT_THREAD_SELF(descr, nr) DO_SET_THREAD_AREA (descr, nr) -#elif defined __NR_set_thread_area -# define INIT_THREAD_SELF(descr, nr) \ -({ \ - if (__builtin_expect (__have_no_set_thread_area, 0) \ - || (DO_SET_THREAD_AREA (descr, DO_SET_THREAD_AREA_REUSE (nr)) == -1 \ - && (__have_no_set_thread_area = 1))) \ - DO_MODIFY_LDT (descr, nr); \ -}) -/* Defined in pspinlock.c. */ -extern int __have_no_set_thread_area; -#else -# define INIT_THREAD_SELF(descr, nr) DO_MODIFY_LDT (descr, nr) -#endif - -/* Free resources associated with thread descriptor. */ -#ifdef __ASSUME_SET_THREAD_AREA_SYSCALL -#define FREE_THREAD(descr, nr) do { } while (0) -#elif defined __NR_set_thread_area -#define FREE_THREAD(descr, nr) \ -{ \ - int __gs; \ - __asm__ __volatile__ ("movw %%gs, %w0" : "=q" (__gs)); \ - if (__builtin_expect (__gs & 4, 0)) \ - { \ - struct modify_ldt_ldt_s ldt_entry = \ - { nr, 0, 0, 0, 0, 1, 0, 1, 0, 0 }; \ - __modify_ldt (1, &ldt_entry, sizeof (ldt_entry)); \ - } \ -} -#else -#define FREE_THREAD(descr, nr) \ -{ \ - struct modify_ldt_ldt_s ldt_entry = \ - { nr, 0, 0, 0, 0, 1, 0, 1, 0, 0 }; \ - __modify_ldt (1, &ldt_entry, sizeof (ldt_entry)); \ -} -#endif - -/* Read member of the thread descriptor directly. */ -#define THREAD_GETMEM(descr, member) \ -({ \ - __typeof__ (descr->member) __value; \ - if (sizeof (__value) == 1) \ - __asm__ __volatile__ ("movb %%gs:%P2,%b0" \ - : "=q" (__value) \ - : "0" (0), \ - "i" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else if (sizeof (__value) == 4) \ - __asm__ __volatile__ ("movl %%gs:%P1,%0" \ - : "=r" (__value) \ - : "i" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else \ - { \ - if (sizeof (__value) != 8) \ - /* There should not be any value with a size other than 1, 4 or 8. */\ - abort (); \ - \ - __asm__ __volatile__ ("movl %%gs:%P1,%%eax\n\t" \ - "movl %%gs:%P2,%%edx" \ - : "=A" (__value) \ - : "i" (offsetof (struct _pthread_descr_struct, \ - member)), \ - "i" (offsetof (struct _pthread_descr_struct, \ - member) + 4)); \ - } \ - __value; \ -}) - -/* Same as THREAD_GETMEM, but the member offset can be non-constant. */ -#define THREAD_GETMEM_NC(descr, member) \ -({ \ - __typeof__ (descr->member) __value; \ - if (sizeof (__value) == 1) \ - __asm__ __volatile__ ("movb %%gs:(%2),%b0" \ - : "=q" (__value) \ - : "0" (0), \ - "r" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else if (sizeof (__value) == 4) \ - __asm__ __volatile__ ("movl %%gs:(%1),%0" \ - : "=r" (__value) \ - : "r" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else \ - { \ - if (sizeof (__value) != 8) \ - /* There should not be any value with a size other than 1, 4 or 8. */\ - abort (); \ - \ - __asm__ __volatile__ ("movl %%gs:(%1),%%eax\n\t" \ - "movl %%gs:4(%1),%%edx" \ - : "=&A" (__value) \ - : "r" (offsetof (struct _pthread_descr_struct, \ - member))); \ - } \ - __value; \ -}) - -/* Same as THREAD_SETMEM, but the member offset can be non-constant. */ -#define THREAD_SETMEM(descr, member, value) \ -({ \ - __typeof__ (descr->member) __value = (value); \ - if (sizeof (__value) == 1) \ - __asm__ __volatile__ ("movb %0,%%gs:%P1" : \ - : "q" (__value), \ - "i" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else if (sizeof (__value) == 4) \ - __asm__ __volatile__ ("movl %0,%%gs:%P1" : \ - : "r" (__value), \ - "i" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else \ - { \ - if (sizeof (__value) != 8) \ - /* There should not be any value with a size other than 1, 4 or 8. */\ - abort (); \ - \ - __asm__ __volatile__ ("movl %%eax,%%gs:%P1\n\n" \ - "movl %%edx,%%gs:%P2" : \ - : "A" (__value), \ - "i" (offsetof (struct _pthread_descr_struct, \ - member)), \ - "i" (offsetof (struct _pthread_descr_struct, \ - member) + 4)); \ - } \ -}) - -/* Set member of the thread descriptor directly. */ -#define THREAD_SETMEM_NC(descr, member, value) \ -({ \ - __typeof__ (descr->member) __value = (value); \ - if (sizeof (__value) == 1) \ - __asm__ __volatile__ ("movb %0,%%gs:(%1)" : \ - : "q" (__value), \ - "r" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else if (sizeof (__value) == 4) \ - __asm__ __volatile__ ("movl %0,%%gs:(%1)" : \ - : "r" (__value), \ - "r" (offsetof (struct _pthread_descr_struct, \ - member))); \ - else \ - { \ - if (sizeof (__value) != 8) \ - /* There should not be any value with a size other than 1, 4 or 8. */\ - abort (); \ - \ - __asm__ __volatile__ ("movl %%eax,%%gs:(%1)\n\t" \ - "movl %%edx,%%gs:4(%1)" : \ - : "A" (__value), \ - "r" (offsetof (struct _pthread_descr_struct, \ - member))); \ - } \ -}) -#endif - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 8*1024*1024 diff --git a/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h deleted file mode 100644 index f4c6be989..000000000 --- a/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - IA-64 version. - Copyright (C) 1999, 2000, 2002, 2003, 2004 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#include -#include - -#include -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_always_inline -#endif - -/* 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. */ -#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) - -#ifndef ELF_MACHINE_NAME - -#define NEED_SEPARATE_REGISTER_STACK - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 32*1024*1024 - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. - r12 (sp) is the stack pointer. */ -#define CURRENT_STACK_FRAME stack_pointer -register char *stack_pointer __asm__ ("sp"); - - -/* Register r13 (tp) is reserved by the ABI as "thread pointer". */ -struct _pthread_descr_struct; -register struct _pthread_descr_struct *__thread_self __asm__("r13"); - -/* Return the thread descriptor for the current thread. */ -#define THREAD_SELF __thread_self - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) - - -/* Access to data in the thread descriptor is easy. */ -#define THREAD_GETMEM(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_GETMEM_NC(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_SETMEM(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) -#define THREAD_SETMEM_NC(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) - - -/* Memory barrier */ -#define MEMORY_BARRIER() __sync_synchronize () - - -#define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS - -PT_EI int -__compare_and_swap (long int *p, long int oldval, long int newval) -{ - long int readval; - - __asm__ __volatile__ - ("mov ar.ccv=%4;;\n\t" - "cmpxchg8.acq %0=%1,%2,ar.ccv" - : "=r" (readval), "=m" (__atomic_fool_gcc (p)) - : "r"(newval), "m" (__atomic_fool_gcc (p)), "r" (oldval) - : "memory"); - return readval == oldval; -} - -PT_EI int -__compare_and_swap_with_release_semantics (long int *p, - long int oldval, - long int newval) -{ - long int readval; - - __asm__ __volatile__ - ("mov ar.ccv=%4;;\n\t" - "cmpxchg8.rel %0=%1,%2,ar.ccv" - : "=r" (readval), "=m" (__atomic_fool_gcc (p)) - : "r"(newval), "m" (__atomic_fool_gcc (p)), "r" (oldval) - : "memory"); - return readval == oldval; -} - -#endif /* ELF_MACHINE_NAME */ - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - long int ret; - - __asm__ __volatile__( - "xchg4 %0=%1,%2" - : "=r"(ret), "=m"(__atomic_fool_gcc (spinlock)) - : "r"(1), "m"(__atomic_fool_gcc (spinlock)) - : "memory"); - - return ret; -} - -/* Indicate that we are looping. */ -#define BUSY_WAIT_NOP __asm__ ("hint @pause") - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/ia64/tls.h b/libpthread/linuxthreads.old/sysdeps/ia64/tls.h deleted file mode 100644 index a78f0ec7a..000000000 --- a/libpthread/linuxthreads.old/sysdeps/ia64/tls.h +++ /dev/null @@ -1,138 +0,0 @@ -/* Definitions for thread-local data handling. linuxthreads/IA-64 version. - Copyright (C) 2002, 2003, 2004, 2005 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, see - . */ - -#ifndef _TLS_H -#define _TLS_H - -#ifndef __ASSEMBLER__ - -# include -# include -# include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - -#else /* __ASSEMBLER__ */ -# include -#endif /* __ASSEMBLER__ */ - -#ifdef HAVE_TLS_SUPPORT - -/* Signal that TLS support is available. */ -# define USE_TLS 1 - -# ifndef __ASSEMBLER__ - -typedef struct -{ - dtv_t *dtv; - void *private; -} tcbhead_t; - -/* This is the size of the initial TCB. */ -# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) - -/* Alignment requirements for the initial TCB. */ -# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t) - -/* This is the size of the TCB. */ -# define TLS_TCB_SIZE sizeof (tcbhead_t) - -/* This is the size we need before TCB. */ -# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct) - -/* Alignment requirements for the TCB. */ -# define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct) - -/* The DTV is allocated at the TP; the TCB is placed elsewhere. */ -# define TLS_DTV_AT_TP 1 - -/* Install the dtv pointer. The pointer passed is to the element with - index -1 which contain the length. */ -# define INSTALL_DTV(tcbp, dtvp) \ - ((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1 - -/* Install new dtv for current thread. */ -# define INSTALL_NEW_DTV(DTV) \ - (((tcbhead_t *)__thread_self)->dtv = (DTV)) - -/* Return dtv of given thread descriptor. */ -# define GET_DTV(tcbp) \ - (((tcbhead_t *) (tcbp))->dtv) - -#if defined NEED_DL_SYSINFO -# define INIT_SYSINFO \ - (((tcbhead_t *) __thread_self)->private = (void *) GLRO(dl_sysinfo)) -#else -# define INIT_SYSINFO 0 -#endif - -/* Code to initially initialize the thread pointer. This might need - special attention since 'errno' is not yet available and if the - operation can cause a failure 'errno' must not be touched. */ -# define TLS_INIT_TP(tcbp, secondcall) \ - (__thread_self = (__typeof (__thread_self)) (tcbp), INIT_SYSINFO, NULL) - -/* Return the address of the dtv for the current thread. */ -# define THREAD_DTV() \ - (((tcbhead_t *)__thread_self)->dtv) - -/* Return the thread descriptor for the current thread. */ -# undef THREAD_SELF -# define THREAD_SELF (__thread_self - 1) - -# undef INIT_THREAD_SELF -# define INIT_THREAD_SELF(descr, nr) \ - (__thread_self = (struct _pthread_descr_struct *)(descr) + 1) - -# define TLS_MULTIPLE_THREADS_IN_TCB 1 - -# endif - -#else - -# ifndef __ASSEMBLER__ - -typedef struct -{ - void *tcb; - dtv_t *dtv; - void *self; - int multiple_threads; -} tcbhead_t; - -# define NONTLS_INIT_TP \ - do { \ - static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 }; \ - __thread_self = (__typeof (__thread_self)) &nontls_init_tp; \ - } while (0) - -#endif - -#endif /* USE_TLS */ - -#endif /* tls.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h deleted file mode 100644 index 3be216524..000000000 --- a/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - m68k version. - Copyright (C) 1996, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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