From 481de81559b8c58c7745a29d560c304a0f6c2658 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 6 Sep 2014 14:45:42 +0200 Subject: linuxthreads: remove unused s390 code Cleanup linuxthreads by removing unused s390 code. Signed-off-by: Waldemar Brodkorb --- libpthread/linuxthreads/sysdeps/s390/pspinlock.c | 90 ------------- .../linuxthreads/sysdeps/s390/s390-32/pt-machine.h | 119 ----------------- .../linuxthreads/sysdeps/s390/s390-64/pt-machine.h | 124 ------------------ .../linuxthreads/sysdeps/s390/tcb-offsets.sym | 4 - libpthread/linuxthreads/sysdeps/s390/tls.h | 144 --------------------- 5 files changed, 481 deletions(-) delete mode 100644 libpthread/linuxthreads/sysdeps/s390/pspinlock.c delete mode 100644 libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym delete mode 100644 libpthread/linuxthreads/sysdeps/s390/tls.h (limited to 'libpthread/linuxthreads/sysdeps/s390') diff --git a/libpthread/linuxthreads/sysdeps/s390/pspinlock.c b/libpthread/linuxthreads/sysdeps/s390/pspinlock.c deleted file mode 100644 index be7578642..000000000 --- a/libpthread/linuxthreads/sysdeps/s390/pspinlock.c +++ /dev/null @@ -1,90 +0,0 @@ -/* POSIX spinlock implementation. S/390 version. - Copyright (C) 2000, 2004 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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" - -/* This implementation is similar to the one used in the Linux kernel. - But the kernel is byte instructions for the memory access. This is - faster but unusable here. The problem is that only 128 - threads/processes could use the spinlock at the same time. If (by - a design error in the program) a thread/process would hold the - spinlock for a time long enough to accumulate 128 waiting - processes, the next one will find a positive value in the spinlock - and assume it is unlocked. We cannot accept that. */ - -int -__pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__(" basr 1,0\n" - "0: slr 0,0\n" - " cs 0,1,%1\n" - " jl 0b\n" - : "=m" (*lock) - : "m" (*lock) : "0", "1", "cc" ); - return 0; -} -weak_alias (__pthread_spin_lock, pthread_spin_lock) - -int -__pthread_spin_trylock (pthread_spinlock_t *lock) -{ - int oldval; - - __asm__ __volatile__(" slr %1,%1\n" - " basr 1,0\n" - "0: cs %1,1,%0" - : "=m" (*lock), "=&d" (oldval) - : "m" (*lock) : "1", "cc" ); - return oldval == 0 ? 0 : EBUSY; -} -weak_alias (__pthread_spin_trylock, pthread_spin_trylock) - - -int -__pthread_spin_unlock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__(" xc 0(4,%0),0(%0)\n" - " bcr 15,0" - : : "a" (lock) : "memory" ); - 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 = 0; - 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/sysdeps/s390/s390-32/pt-machine.h b/libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h deleted file mode 100644 index 51505a97d..000000000 --- a/libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - S390 version. - Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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 - -#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); - -/* 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. */ -#define MEMORY_BARRIER() __asm__ __volatile__ ("bcr 15,0" : : : "memory") - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__( - " la 1,%1\n" - " lhi 0,1\n" - " l %0,%1\n" - "0: cs %0,0,0(1)\n" - " jl 0b" - : "=&d" (ret), "+m" (*spinlock) - : : "0", "1", "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__ ("15"); - -#ifdef __UCLIBC_HAS_TLS__ -/* Return the thread descriptor for the current thread. */ -# define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ()) - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) __builtin_set_thread_pointer (descr) -#else -/* Return the thread descriptor for the current thread. - S/390 registers uses access register 0 as "thread register". */ -#define THREAD_SELF ({ \ - register pthread_descr __self; \ - __asm__ ("ear %0,%%a0" : "=d" (__self) ); \ - __self; \ -}) - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) ({ \ - __asm__ ("sar %%a0,%0" : : "d" (descr) ); \ -}) -#endif - -/* 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)) - -/* 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 - -/* 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) -{ - int retval; - - __asm__ __volatile__( - " la 1,%1\n" - " lr 0,%2\n" - " cs 0,%3,0(1)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "+m" (*p) - : "d" (oldval) , "d" (newval) - : "cc", "0", "1" ); - return retval == 0; -} - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h b/libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h deleted file mode 100644 index 4bff85aec..000000000 --- a/libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - 64 bit S/390 version. - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - 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 - -#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); - -/* 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. */ -#define MEMORY_BARRIER() __asm__ __volatile__ ("bcr 15,0" : : : "memory") - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__( - " la 1,%1\n" - " lhi 0,1\n" - " l %0,%1\n" - "0: cs %0,0,0(1)\n" - " jl 0b" - : "=&d" (ret), "+m" (*spinlock) - : : "0", "1", "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__ ("15"); - -#ifdef __UCLIBC_HAS_TLS__ -/* Return the thread descriptor for the current thread. */ -# define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ()) - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) __builtin_set_thread_pointer (descr) -#else -/* Return the thread descriptor for the current thread. - 64 bit S/390 uses access register 0 and 1 as "thread register". */ -#define THREAD_SELF ({ \ - register pthread_descr __self; \ - __asm__ (" ear %0,%%a0\n" \ - " sllg %0,%0,32\n" \ - " ear %0,%%a1\n" \ - : "=d" (__self) ); \ - __self; \ -}) - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) ({ \ - __asm__ (" sar %%a1,%0\n" \ - " srlg 0,%0,32\n" \ - " sar %%a0,0\n" \ - : : "d" (descr) : "0" ); \ -}) -#endif - -/* 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)) - -/* 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 - -/* 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) -{ - int retval; - - __asm__ __volatile__( - " lgr 0,%2\n" - " csg 0,%3,%1\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "+m" (*p) - : "d" (oldval) , "d" (newval) - : "cc", "0"); - return retval == 0; -} - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym b/libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym deleted file mode 100644 index aee6be257..000000000 --- a/libpthread/linuxthreads/sysdeps/s390/tcb-offsets.sym +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) diff --git a/libpthread/linuxthreads/sysdeps/s390/tls.h b/libpthread/linuxthreads/sysdeps/s390/tls.h deleted file mode 100644 index d987bdbc2..000000000 --- a/libpthread/linuxthreads/sysdeps/s390/tls.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Definitions for thread-local data handling. linuxthreads/s390 version. - Copyright (C) 2002, 2003, 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; - -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. */ - int multiple_threads; -} tcbhead_t; - -#else /* __ASSEMBLER__ */ -# include -#endif /* __ASSEMBLER__ */ - -/* TLS is always supported if the tools support it. There are no - kernel dependencies. To avoid bothering with the TLS support code - at all, use configure --without-tls. - - We need USE_TLS to be consistently defined, for ldsodefs.h - conditionals. */ - -#ifdef 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) \ - (((tcbhead_t *) __builtin_thread_pointer ())->dtv = (dtv)) - -/* Return dtv of given thread descriptor. */ -# define GET_DTV(descr) \ - (((tcbhead_t *) (descr))->dtv) - -/* 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. - - The value of this macro is null if successful, or an error string. */ -# define TLS_INIT_TP(descr, secondcall) \ - ({ \ - void *_descr = (descr); \ - tcbhead_t *head = _descr; \ - \ - head->tcb = _descr; \ - /* For now the thread descriptor is at the same address. */ \ - head->self = _descr; \ - \ - __builtin_set_thread_pointer (_descr); \ - NULL; \ - }) - -/* Return the address of the dtv for the current thread. */ -# define THREAD_DTV() \ - (((tcbhead_t *) __builtin_thread_pointer ())->dtv) - -# endif /* __ASSEMBLER__ */ - -#else /* HAVE_TLS_SUPPORT && (FLOATING_STACKS || !IS_IN_libpthread) */ - -# ifndef __ASSEMBLER__ - -/* Get the thread descriptor definition. */ -# include - -# define NONTLS_INIT_TP \ - do { \ - static const tcbhead_t nontls_init_tp \ - = { .multiple_threads = 0 }; \ - INIT_THREAD_SELF (&nontls_init_tp, 0); \ - } while (0) - -# endif /* __ASSEMBLER__ */ - -#endif /* HAVE_TLS_SUPPORT && (FLOATING_STACKS || !IS_IN_libpthread) */ - -#endif /* tls.h */ -- cgit v1.2.3