Remove IA-64 support from NPTL

This commit is contained in:
Ulrich Drepper 2012-01-07 12:16:05 -05:00
parent 305502f69d
commit 120ced3f5d
32 changed files with 6 additions and 2005 deletions

View File

@ -1,3 +1,9 @@
2012-01-07 Ulrich Drepper <drepper@gmail.com>
In case anyone cares, the IA-64 architecture could move to ports.
* sysdeps/ia64/*: Removed.
* sysdeps/unix/sysv/linux/ia64/*: Removed.
2011-12-22 Ulrich Drepper <drepper@gmail.com>
* sysdeps/pthread/gai_misc.h (__gai_create_helper_thread): Use

View File

@ -1,25 +0,0 @@
# Copyright (C) 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; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
ifeq ($(subdir),csu)
gen-as-const-headers += tcb-offsets.sym
endif
ifeq ($(subdir),nptl)
libpthread-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask
endif

View File

@ -1,36 +0,0 @@
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "pthreadP.h"
int
pthread_spin_lock (lock)
pthread_spinlock_t *lock;
{
int *p = (int *) lock;
while (__builtin_expect (__sync_val_compare_and_swap (p, 0, 1), 0))
{
/* Spin without using the atomic instruction. */
do
__asm __volatile ("hint @pause" : : : "memory");
while (*p);
}
return 0;
}

View File

@ -1,28 +0,0 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include "pthreadP.h"
int
pthread_spin_trylock (lock)
pthread_spinlock_t *lock;
{
return __sync_val_compare_and_swap ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
}

View File

@ -1,28 +0,0 @@
/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "pthreadP.h"
int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
__sync_lock_release ((int *) lock);
return 0;
}

View File

@ -1,43 +0,0 @@
/* Copyright (C) 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; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Default stack size. */
#define ARCH_STACK_DEFAULT_SIZE (32 * 1024 * 1024)
/* IA-64 uses a normal stack and a register stack. */
#define NEED_SEPARATE_REGISTER_STACK
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
/* Minimal stack size after allocating thread descriptor and guard size. */
#define MINIMAL_REST_STACK 16384
/* Alignment requirement for TCB. */
#define TCB_ALIGNMENT 16
/* Location of current stack frame. */
#define CURRENT_STACK_FRAME __stack_pointer
register char *__stack_pointer __asm__ ("sp");
/* XXX Until we have a better place keep the definitions here. */
/* While there is no such syscall. */
#define __exit_thread_inline(val) \
INLINE_SYSCALL (exit, 1, (val))

View File

@ -1,7 +0,0 @@
#include <sysdep.h>
#include <tls.h>
PID offsetof (struct pthread, pid) - TLS_PRE_TCB_SIZE
TID offsetof (struct pthread, tid) - TLS_PRE_TCB_SIZE
MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - TLS_PRE_TCB_SIZE
SYSINFO_OFFSET offsetof (tcbhead_t, __private)

View File

@ -1,186 +0,0 @@
/* Definition for thread-local data handling. nptl/IA-64 version.
Copyright (C) 2003-2007, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _TLS_H
#define _TLS_H 1
#include <dl-sysdep.h>
#ifndef __ASSEMBLER__
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
# include <stdlib.h>
# include <list.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
typedef struct
{
dtv_t *dtv;
void *__private;
} tcbhead_t;
register struct pthread *__thread_self __asm__("r13");
# define TLS_MULTIPLE_THREADS_IN_TCB 1
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>
#endif
/* Alignment requirement for the stack. */
#define STACK_ALIGN 16
#ifndef __ASSEMBLER__
/* Get system call information. */
# include <sysdep.h>
/* 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.
If there is not any room for uintptr_t stack_guard and
uintptr_t pointer_guard in struct pthread's final padding,
we need to put struct pthread 16 byte slower. */
# define TLS_PRE_TCB_SIZE \
(sizeof (struct pthread) \
+ (PTHREAD_STRUCT_END_PADDING < 2 * sizeof (uintptr_t) \
? ((2 * sizeof (uintptr_t) + __alignof__ (struct pthread) - 1) \
& ~(__alignof__ (struct pthread) - 1)) \
: 0))
/* Alignment requirements for the TCB. */
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
/* The DTV is allocated at the TP; the TCB is placed elsewhere. */
# define TLS_DTV_AT_TP 1
/* Get the thread descriptor definition. */
# include <nptl/descr.h>
/* 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 *)__thread_self)->dtv = (DTV))
/* Return dtv of given thread descriptor. */
# define GET_DTV(descr) \
(((tcbhead_t *) (descr))->dtv)
#define THREAD_SELF_SYSINFO (((tcbhead_t *) __thread_self)->__private)
#define THREAD_SYSINFO(pd) \
(((tcbhead_t *) ((char *) (pd) + TLS_PRE_TCB_SIZE))->__private)
#if defined NEED_DL_SYSINFO
# define INIT_SYSINFO THREAD_SELF_SYSINFO = (void *) GLRO(dl_sysinfo)
#else
# define INIT_SYSINFO NULL
#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(thrdescr, secondcall) \
(__thread_self = (thrdescr), 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. */
# define THREAD_SELF \
((struct pthread *) ((char *) __thread_self - TLS_PRE_TCB_SIZE))
/* Magic for libthread_db to know how to do THREAD_SELF. */
# define DB_THREAD_SELF REGISTER (64, 64, 13 * 8, -TLS_PRE_TCB_SIZE)
/* Access to data in the thread descriptor is easy. */
#define THREAD_GETMEM(descr, member) \
descr->member
#define THREAD_GETMEM_NC(descr, member, idx) \
descr->member[idx]
#define THREAD_SETMEM(descr, member, value) \
descr->member = (value)
#define THREAD_SETMEM_NC(descr, member, idx, value) \
descr->member[idx] = (value)
/* Set the stack guard field in TCB head. */
#define THREAD_SET_STACK_GUARD(value) \
(((uintptr_t *) __thread_self)[-1] = (value))
#define THREAD_COPY_STACK_GUARD(descr) \
(((uintptr_t *) ((char *) (descr) + TLS_PRE_TCB_SIZE))[-1] \
= ((uintptr_t *) __thread_self)[-1])
/* Set the pointer guard field in TCB head. */
#define THREAD_GET_POINTER_GUARD() \
(((uintptr_t *) __thread_self)[-2])
#define THREAD_SET_POINTER_GUARD(value) \
(((uintptr_t *) __thread_self)[-2] = (value))
#define THREAD_COPY_POINTER_GUARD(descr) \
(((uintptr_t *) ((char *) (descr) + TLS_PRE_TCB_SIZE))[-2] \
= THREAD_GET_POINTER_GUARD ())
/* Get and set the global scope generation counter in struct pthread. */
#define THREAD_GSCOPE_FLAG_UNUSED 0
#define THREAD_GSCOPE_FLAG_USED 1
#define THREAD_GSCOPE_FLAG_WAIT 2
#define THREAD_GSCOPE_RESET_FLAG() \
do \
{ int __res \
= atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
THREAD_GSCOPE_FLAG_UNUSED); \
if (__res == THREAD_GSCOPE_FLAG_WAIT) \
lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \
} \
while (0)
#define THREAD_GSCOPE_SET_FLAG() \
do \
{ \
THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
atomic_write_barrier (); \
} \
while (0)
#define THREAD_GSCOPE_WAIT() \
GL(dl_wait_lookup_done) ()
#endif /* __ASSEMBLER__ */
#endif /* tls.h */

View File

@ -1,3 +0,0 @@
ifeq ($(subdir),nptl)
libpthread-sysdep_routines += __ia64_longjmp unwind_longjmp __sigstack_longjmp
endif

View File

@ -1,13 +0,0 @@
libpthread {
GLIBC_2.3.3 {
# Changed PTHREAD_STACK_MIN.
pthread_attr_setstack; pthread_attr_setstacksize;
}
}
librt {
GLIBC_2.3.3 {
# Changed timer_t.
timer_create; timer_delete; timer_getoverrun; timer_gettime;
timer_settime;
}
}

View File

@ -1,159 +0,0 @@
/* Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <features.h>
LEAF(__ia64_flush_rbs)
flushrs
mov r9 = ar.rsc // 12 cyc latency
;;
mov r8 = ar.bsp // 12 cyc latency
;;
and r16 = ~0x3, r9 // clear ar.rsc.mode
;;
mov ar.rsc = r16 // put RSE into enforced-lazy mode
;;
mov r10 = ar.rnat // 5 cyc latency
ret
END(__ia64_flush_rbs)
# define pPos p6 /* is rotate count positive? */
# define pNeg p7 /* is rotate count negative? */
/* __ia64_longjmp(__jmp_buf buf, int val, long rnat, long rsc) */
LEAF(__ia64_longjmp)
alloc r8=ar.pfs,4,0,0,0
add r2=0x98,in0 // r2 <- &jmpbuf.orig_jmp_buf_addr
add r3=0x88,in0 // r3 <- &jmpbuf.ar_bsp
;;
ld8 r8=[r2] // r8 <- orig_jmp_buf_addr
ld8 r23=[r3],8 // r23 <- jmpbuf.ar_bsp
mov r2=in0
;;
//
// Note: we need to redo the "flushrs" here even though it's
// already been done by __ia64_flush_rbs. It is needed to
// ensure that ar.bspstore == ar.bsp.
//
flushrs // flush dirty regs to backing store
ld8 r25=[r3] // r25 <- jmpbuf.ar_unat
sub r8=r8,in0 // r8 <- &orig_jmpbuf - &jmpbuf
;;
add r3=8,in0 // r3 <- &jmpbuf.r1
extr.u r8=r8,3,6 // r8 <- (&orig_jmpbuf - &jmpbuf)/8 & 0x3f
;;
cmp.lt pNeg,pPos=r8,r0
;;
(pPos) mov r16=r8
(pNeg) add r16=64,r8
(pPos) sub r17=64,r8
(pNeg) sub r17=r0,r8
;;
shr.u r8=r25,r16
shl r9=r25,r17
;;
or r25=r8,r9
;;
mov ar.unat=r25 // setup ar.unat (NaT bits for r1, r4-r7, and r12)
;;
ld8.fill.nta sp=[r2],16 // r12 (sp)
ld8.fill.nta gp=[r3],16 // r1 (gp)
dep r11=-1,r23,3,6 // r11 <- ia64_rse_rnat_addr(jmpbuf.ar_bsp)
;;
ld8.nta r16=[r2],16 // caller's unat
ld8.nta r17=[r3],16 // fpsr
;;
ld8.fill.nta r4=[r2],16 // r4
ld8.fill.nta r5=[r3],16 // r5 (gp)
;;
ld8.fill.nta r6=[r2],16 // r6
ld8.fill.nta r7=[r3],16 // r7
;;
mov ar.unat=r16 // restore caller's unat
mov ar.fpsr=r17 // restore fpsr
;;
ld8.nta r16=[r2],16 // b0
ld8.nta r17=[r3],16 // b1
;;
mov ar.bspstore=r23 // restore ar.bspstore
ld8.nta r18=[r2],16 // b2
;;
mov ar.rnat=in2 // restore ar.rnat
ld8.nta r19=[r3],16 // b3
;;
ld8.nta r20=[r2],16 // b4
ld8.nta r21=[r3],16 // b5
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (r16, r24)
#endif
;;
ld8.nta r11=[r2],16 // ar.pfs
ld8.nta r22=[r3],56 // ar.lc
;;
ld8.nta r24=[r2],32 // pr
mov ar.rsc=in3 // restore ar.rsc
mov b0=r16
;;
ldf.fill.nta f2=[r2],32
ldf.fill.nta f3=[r3],32
mov b1=r17
;;
ldf.fill.nta f4=[r2],32
ldf.fill.nta f5=[r3],32
mov b2=r18
;;
ldf.fill.nta f16=[r2],32
ldf.fill.nta f17=[r3],32
mov b3=r19
;;
ldf.fill.nta f18=[r2],32
ldf.fill.nta f19=[r3],32
mov b4=r20
;;
ldf.fill.nta f20=[r2],32
ldf.fill.nta f21=[r3],32
mov b5=r21
;;
ldf.fill.nta f22=[r2],32
ldf.fill.nta f23=[r3],32
mov ar.lc=r22
;;
ldf.fill.nta f24=[r2],32
ldf.fill.nta f25=[r3],32
cmp.eq p8,p9=0,in1
;;
ldf.fill.nta f26=[r2],32
ldf.fill.nta f27=[r3],32
mov ar.pfs=r11
;;
ldf.fill.nta f28=[r2],32
ldf.fill.nta f29=[r3],32
(p8) mov r8=1
;;
ldf.fill.nta f30=[r2]
ldf.fill.nta f31=[r3]
(p9) mov r8=in1
invala // virt. -> phys. regnum mapping may change
mov pr=r24,-1
ret
END(__ia64_longjmp)

View File

@ -1,168 +0,0 @@
/* Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* The public __longjmp() implementation is limited to jumping within
the same stack. That is, in general it is not possible to use this
__longjmp() implementation to cross from one stack to another.
In constrast, the __sigstack_longjmp() implemented here allows
crossing from the alternate signal stack to the normal stack
as a special case. */
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <sysdep.h>
#include <sys/rse.h>
#define JB_SP 0
#define JB_BSP 17
struct rbs_flush_values
{
unsigned long bsp;
unsigned long rsc;
unsigned long rnat;
};
extern struct rbs_flush_values __ia64_flush_rbs (void);
extern void __ia64_longjmp (__jmp_buf buf, int val, long rnat, long rsc)
__attribute__ ((__noreturn__));
static void
copy_rbs (unsigned long *dst, unsigned long *dst_end, unsigned long dst_rnat,
unsigned long *src, unsigned long *src_end,
unsigned long current_rnat)
{
unsigned long dst_slot, src_rnat = 0, src_slot, *src_rnat_addr, nat_bit;
int first_time = 1;
while (dst < dst_end)
{
dst_slot = ia64_rse_slot_num (dst);
if (dst_slot == 63)
{
*dst++ = dst_rnat;
dst_rnat = 0;
}
else
{
/* read source value, including NaT bit: */
src_slot = ia64_rse_slot_num (src);
if (src_slot == 63)
{
/* skip src RNaT slot */
++src;
src_slot = 0;
}
if (first_time || src_slot == 0)
{
first_time = 0;
src_rnat_addr = ia64_rse_rnat_addr (src);
if (src_rnat_addr < src_end)
src_rnat = *src_rnat_addr;
else
src_rnat = current_rnat;
}
nat_bit = (src_rnat >> src_slot) & 1;
assert (src < src_end);
*dst++ = *src++;
if (nat_bit)
dst_rnat |= (1UL << dst_slot);
else
dst_rnat &= ~(1UL << dst_slot);
}
}
dst_slot = ia64_rse_slot_num (dst);
if (dst_slot > 0)
*ia64_rse_rnat_addr (dst) = dst_rnat;
}
void
__sigstack_longjmp (__jmp_buf buf, int val)
{
unsigned long *rbs_base, *bsp, *bspstore, *jb_bsp, jb_sp, ss_sp;
unsigned long ndirty, rnat, load_rnat, *jb_rnat_addr;
struct sigcontext *sc;
stack_t stk;
struct rbs_flush_values c;
/* put RSE into enforced-lazy mode and return current bsp/rsc/rnat: */
c = __ia64_flush_rbs ();
jb_sp = ((unsigned long *) buf)[JB_SP];
jb_bsp = ((unsigned long **) buf)[JB_BSP];
INTERNAL_SYSCALL_DECL (err);
(void) INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &stk);
ss_sp = (unsigned long) stk.ss_sp;
jb_rnat_addr = ia64_rse_rnat_addr (jb_bsp);
if ((stk.ss_flags & SS_ONSTACK) == 0 || jb_sp - ss_sp < stk.ss_size)
/* Normal non-stack-crossing longjmp; if the RNaT slot for the bsp
saved in the jump-buffer is the same as the one for the current
BSP, use the current AR.RNAT value, otherwise, load it from the
jump-buffer's RNaT-slot. */
load_rnat = (ia64_rse_rnat_addr ((unsigned long *) c.bsp) != jb_rnat_addr);
else
{
/* If we are on the alternate signal-stack and the jump-buffer
lies outside the signal-stack, we may need to copy back the
dirty partition which was torn off and saved on the
signal-stack when the signal was delivered.
Caveat: we assume that the top of the alternate signal-stack
stores the sigcontext structure of the signal that
caused the switch to the signal-stack. This should
be a fairly safe assumption but the kernel _could_
do things differently.. */
sc = ((struct sigcontext *) ((ss_sp + stk.ss_size) & -16) - 1);
/* As a sanity-check, verify that the register-backing-store base
of the alternate signal-stack is where we expect it. */
rbs_base = (unsigned long *)
((ss_sp + sizeof (long) - 1) & -sizeof (long));
assert ((unsigned long) rbs_base == sc->sc_rbs_base);
ndirty = ia64_rse_num_regs (rbs_base, rbs_base + (sc->sc_loadrs >> 19));
bsp = (unsigned long *) sc->sc_ar_bsp;
bspstore = ia64_rse_skip_regs (bsp, -ndirty);
if (bspstore < jb_bsp)
/* AR.BSPSTORE at the time of the signal was below the value
of AR.BSP saved in the jump-buffer => copy the missing
portion from the torn off dirty partition which got saved
on the alternate signal-stack. */
copy_rbs (bspstore, jb_bsp, sc->sc_ar_rnat,
rbs_base, (unsigned long *) c.bsp, c.rnat);
load_rnat = 1;
}
if (load_rnat)
rnat = *jb_rnat_addr;
else
rnat = c.rnat;
__ia64_longjmp (buf, val, rnat, c.rsc);
}

View File

@ -1,100 +0,0 @@
/* Minimum guaranteed maximum values for system limits. Linux/IA-64 version.
Copyright (C) 1993-1998,2000,2002-2004,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. */
/* The kernel header pollutes the namespace with the NR_OPEN symbol
and defines LINK_MAX although filesystems have different maxima. A
similar thing is true for OPEN_MAX: the limit can be changed at
runtime and therefore the macro must not be defined. Remove this
after including the header if necessary. */
#ifndef NR_OPEN
# define __undef_NR_OPEN
#endif
#ifndef LINK_MAX
# define __undef_LINK_MAX
#endif
#ifndef OPEN_MAX
# define __undef_OPEN_MAX
#endif
#ifndef ARG_MAX
# define __undef_ARG_MAX
#endif
/* The kernel sources contain a file with all the needed information. */
#include <linux/limits.h>
/* Have to remove NR_OPEN? */
#ifdef __undef_NR_OPEN
# undef NR_OPEN
# undef __undef_NR_OPEN
#endif
/* Have to remove LINK_MAX? */
#ifdef __undef_LINK_MAX
# undef LINK_MAX
# undef __undef_LINK_MAX
#endif
/* Have to remove OPEN_MAX? */
#ifdef __undef_OPEN_MAX
# undef OPEN_MAX
# undef __undef_OPEN_MAX
#endif
/* Have to remove ARG_MAX? */
#ifdef __undef_ARG_MAX
# undef ARG_MAX
# undef __undef_ARG_MAX
#endif
/* The number of data keys per process. */
#define _POSIX_THREAD_KEYS_MAX 128
/* This is the value this implementation supports. */
#define PTHREAD_KEYS_MAX 1024
/* Controlling the iterations of destructors for thread-specific data. */
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
/* Number of iterations this implementation does. */
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
/* The number of threads per process. */
#define _POSIX_THREAD_THREADS_MAX 64
/* We have no predefined limit on the number of threads. */
#undef PTHREAD_THREADS_MAX
/* Maximum amount by which a process can descrease its asynchronous I/O
priority level. */
#define AIO_PRIO_DELTA_MAX 20
/* Minimum size for a thread. We are free to choose a reasonable value. */
#define PTHREAD_STACK_MIN 196608
/* Maximum number of timer expiration overruns. */
#define DELAYTIMER_MAX 2147483647
/* Maximum tty name length. */
#define TTY_NAME_MAX 32
/* Maximum login name length. This is arbitrary. */
#define LOGIN_NAME_MAX 256
/* Maximum host name length. */
#define HOST_NAME_MAX 64
/* Maximum message queue priority level. */
#define MQ_PRIO_MAX 32768
/* Maximum value the semaphore can have. */
#define SEM_VALUE_MAX (2147483647)

View File

@ -1,169 +0,0 @@
/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H 1
#define __SIZEOF_PTHREAD_ATTR_T 56
#define __SIZEOF_PTHREAD_MUTEX_T 40
#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_CONDATTR_T 4
#define __SIZEOF_PTHREAD_RWLOCK_T 56
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIER_T 32
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
/* Thread identifiers. The structure of the attribute type is not
exposed on purpose. */
typedef unsigned long int pthread_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_ATTR_T];
long int __align;
} pthread_attr_t;
typedef struct __pthread_internal_list
{
struct __pthread_internal_list *__prev;
struct __pthread_internal_list *__next;
} __pthread_list_t;
/* Data structures for mutex handling. The structure of the attribute
type is not exposed on purpose. */
typedef union
{
struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
int __owner;
unsigned int __nusers;
/* KIND must stay at this position in the structure to maintain
binary compatibility. */
int __kind;
int __spins;
__pthread_list_t __list;
#define __PTHREAD_MUTEX_HAVE_PREV 1
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;
} pthread_mutex_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
/* Data structure for conditional variable handling. The structure of
the attribute type is not exposed on purpose. */
typedef union
{
struct
{
int __lock;
unsigned int __futex;
__extension__ unsigned long long int __total_seq;
__extension__ unsigned long long int __wakeup_seq;
__extension__ unsigned long long int __woken_seq;
void *__mutex;
unsigned int __nwaiters;
unsigned int __broadcast_seq;
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
long int __align;
} pthread_cond_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
/* Keys for thread-specific data */
typedef unsigned int pthread_key_t;
/* Once-only execution */
typedef int pthread_once_t;
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Data structure for read-write lock variable handling. The
structure of the attribute type is not exposed on purpose. */
typedef union
{
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
int __shared;
unsigned long int __pad1;
unsigned long int __pad2;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
} __data;
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
long int __align;
} pthread_rwlock_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
long int __align;
} pthread_rwlockattr_t;
#endif
#ifdef __USE_XOPEN2K
/* POSIX spinlock data type. */
typedef volatile int pthread_spinlock_t;
/* POSIX barriers data type. The structure of the type is
deliberately not exposed. */
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIER_T];
long int __align;
} pthread_barrier_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
int __align;
} pthread_barrierattr_t;
#endif
#endif /* bits/pthreadtypes.h */

View File

@ -1,36 +0,0 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _SEMAPHORE_H
# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
#endif
#define __SIZEOF_SEM_T 32
/* Value returned if `sem_open' failed. */
#define SEM_FAILED ((sem_t *) 0)
typedef union
{
char __size[__SIZEOF_SEM_T];
long int __align;
} sem_t;

View File

@ -1,9 +0,0 @@
/* We want an #include_next, but we are the main source file.
So, #include ourselves and in that incarnation we can use #include_next. */
#ifndef INCLUDED_SELF
# define INCLUDED_SELF
# include <clone2.S>
#else
# define RESET_PID
# include_next <clone2.S>
#endif

View File

@ -1,26 +0,0 @@
/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Value passed to 'clone' for initialization of the thread register. */
#define TLS_VALUE ((char *) pd + TLS_PRE_TCB_SIZE)
#define ARCH_CLONE __clone2
/* Get the real implementation. */
#include <nptl/sysdeps/pthread/createthread.c>

View File

@ -1,77 +0,0 @@
/* System-specific settings for dynamic linker code. IA-64 version.
Copyright (C) 2003, 2004, 2006, 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _DL_SYSDEP_H
#define _DL_SYSDEP_H 1
/* This macro must be defined to either 0 or 1.
If 1, then an errno global variable hidden in ld.so will work right with
all the errno-using libc code compiled for ld.so, and there is never a
need to share the errno location with libc. This is appropriate only if
all the libc functions that ld.so uses are called without PLT and always
get the versions linked into ld.so rather than the libc ones. */
#ifdef IS_IN_rtld
# define RTLD_PRIVATE_ERRNO 1
#else
# define RTLD_PRIVATE_ERRNO 0
#endif
/* Traditionally system calls have been made using break 0x100000. A
second method was introduced which, if possible, will use the EPC
instruction. To signal the presence and where to find the code the
kernel passes an AT_SYSINFO_EHDR pointer in the auxiliary vector to
the application. */
#define NEED_DL_SYSINFO 1
#define USE_DL_SYSINFO 1
#if defined NEED_DL_SYSINFO && !defined __ASSEMBLER__
/* Don't declare this as a function---we want it's entry-point, not
it's function descriptor... */
extern int _dl_sysinfo_break attribute_hidden;
# define DL_SYSINFO_DEFAULT ((uintptr_t) &_dl_sysinfo_break)
# define DL_SYSINFO_IMPLEMENTATION \
asm (".text\n\t" \
".hidden _dl_sysinfo_break\n\t" \
".proc _dl_sysinfo_break\n\t" \
"_dl_sysinfo_break:\n\t" \
".prologue\n\t" \
".altrp b6\n\t" \
".body\n\t" \
"break 0x100000;\n\t" \
"br.ret.sptk.many b6;\n\t" \
".endp _dl_sysinfo_break\n\t" \
".previous");
#endif
/* _dl_argv cannot be attribute_relro, because _dl_start_user
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1
/* The _dl_discover_osversion function is so far only needed in sysconf
to check for kernels later than 2.6.23. */
#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
/* Get version of the OS. */
extern int _dl_discover_osversion (void) attribute_hidden;
# define HAVE_DL_DISCOVER_OSVERSION 1
#endif
#endif /* dl-sysdep.h */

View File

@ -1,31 +0,0 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sched.h>
#include <signal.h>
#include <sysdep.h>
#include <tls.h>
#define ARCH_FORK() \
INLINE_SYSCALL (clone2, 6, \
CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, \
NULL, 0, NULL, &THREAD_SELF->tid, NULL)
#include "../fork.c"

View File

@ -1,295 +0,0 @@
/* Copyright (C) 2003, 2004, 2006-2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
#include <ia64intrin.h>
#include <atomic.h>
#include <kernel-features.h>
#define __NR_futex 1230
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_REQUEUE 3
#define FUTEX_CMP_REQUEUE 4
#define FUTEX_WAKE_OP 5
#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1)
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
#define FUTEX_BITSET_MATCH_ANY 0xffffffff
/* Values for 'private' parameter of locking macros. Yes, the
definition seems to be backwards. But it is not. The bit will be
reversed before passing to the system call. */
#define LLL_PRIVATE 0
#define LLL_SHARED FUTEX_PRIVATE_FLAG
#if !defined NOT_IN_libc || defined IS_IN_rtld
/* In libc.so or ld.so all futexes are private. */
# ifdef __ASSUME_PRIVATE_FUTEX
# define __lll_private_flag(fl, private) \
((fl) | FUTEX_PRIVATE_FLAG)
# else
# define __lll_private_flag(fl, private) \
((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))
# endif
#else
# ifdef __ASSUME_PRIVATE_FUTEX
# define __lll_private_flag(fl, private) \
(((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
# else
# define __lll_private_flag(fl, private) \
(__builtin_constant_p (private) \
? ((private) == 0 \
? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) \
: (fl)) \
: ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \
& THREAD_GETMEM (THREAD_SELF, header.private_futex))))
# endif
#endif
/* Delay in spinlock loop. */
#define BUSY_WAIT_NOP asm ("hint @pause")
#define lll_futex_wait(futex, val, private) \
lll_futex_timed_wait (futex, val, NULL, private)
#define lll_futex_timed_wait(ftx, val, timespec, private) \
({ \
DO_INLINE_SYSCALL(futex, 4, (long) (ftx), \
__lll_private_flag (FUTEX_WAIT, private), \
(int) (val), (long) (timespec)); \
_r10 == -1 ? -_retval : _retval; \
})
#define lll_futex_wake(ftx, nr, private) \
({ \
DO_INLINE_SYSCALL(futex, 3, (long) (ftx), \
__lll_private_flag (FUTEX_WAKE, private), \
(int) (nr)); \
_r10 == -1 ? -_retval : _retval; \
})
#define lll_robust_dead(futexv, private) \
do \
{ \
int *__futexp = &(futexv); \
atomic_or (__futexp, FUTEX_OWNER_DIED); \
DO_INLINE_SYSCALL(futex, 3, (long) __futexp, \
__lll_private_flag (FUTEX_WAKE, private), 1); \
} \
while (0)
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_requeue(ftx, nr_wake, nr_move, mutex, val, private) \
({ \
DO_INLINE_SYSCALL(futex, 6, (long) (ftx), \
__lll_private_flag (FUTEX_CMP_REQUEUE, private), \
(int) (nr_wake), (int) (nr_move), (long) (mutex), \
(int) val); \
_r10 == -1; \
})
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_wake_unlock(ftx, nr_wake, nr_wake2, ftx2, private) \
({ \
DO_INLINE_SYSCALL(futex, 6, (long) (ftx), \
__lll_private_flag (FUTEX_WAKE_OP, private), \
(int) (nr_wake), (int) (nr_wake2), (long) (ftx2), \
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
_r10 == -1; \
})
#define __lll_trylock(futex) \
(atomic_compare_and_exchange_val_acq (futex, 1, 0) != 0)
#define lll_trylock(futex) __lll_trylock (&(futex))
#define __lll_robust_trylock(futex, id) \
(atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
#define lll_robust_trylock(futex, id) \
__lll_robust_trylock (&(futex), id)
#define __lll_cond_trylock(futex) \
(atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0)
#define lll_cond_trylock(futex) __lll_cond_trylock (&(futex))
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
#define __lll_lock(futex, private) \
((void) ({ \
int *__futex = (futex); \
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, \
1, 0), 0)) \
{ \
if (__builtin_constant_p (private) && (private) == LLL_PRIVATE) \
__lll_lock_wait_private (__futex); \
else \
__lll_lock_wait (__futex, private); \
} \
}))
#define lll_lock(futex, private) __lll_lock (&(futex), private)
#define __lll_robust_lock(futex, id, private) \
({ \
int *__futex = (futex); \
int __val = 0; \
\
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id, \
0), 0)) \
__val = __lll_robust_lock_wait (__futex, private); \
__val; \
})
#define lll_robust_lock(futex, id, private) \
__lll_robust_lock (&(futex), id, private)
#define __lll_cond_lock(futex, private) \
((void) ({ \
int *__futex = (futex); \
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, 2, \
0), 0)) \
__lll_lock_wait (__futex, private); \
}))
#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
#define __lll_robust_cond_lock(futex, id, private) \
({ \
int *__futex = (futex); \
int __val = 0; \
int __id = (id) | FUTEX_WAITERS; \
\
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, \
__id, 0), 0)) \
__val = __lll_robust_lock_wait (__futex, private); \
__val; \
})
#define lll_robust_cond_lock(futex, id, private) \
__lll_robust_cond_lock (&(futex), id, private)
extern int __lll_timedlock_wait (int *futex, const struct timespec *,
int private) attribute_hidden;
extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
int private) attribute_hidden;
#define __lll_timedlock(futex, abstime, private) \
({ \
int *__futex = (futex); \
int __val = 0; \
\
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, 1, \
0), 0)) \
__val = __lll_timedlock_wait (__futex, abstime, private); \
__val; \
})
#define lll_timedlock(futex, abstime, private) \
__lll_timedlock (&(futex), abstime, private)
#define __lll_robust_timedlock(futex, abstime, id, private) \
({ \
int *__futex = (futex); \
int __val = 0; \
\
if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id, \
0), 0)) \
__val = __lll_robust_timedlock_wait (__futex, abstime, private); \
__val; \
})
#define lll_robust_timedlock(futex, abstime, id, private) \
__lll_robust_timedlock (&(futex), abstime, id, private)
#define __lll_unlock(futex, private) \
((void) ({ \
int *__futex = (futex); \
int __val = atomic_exchange_rel (__futex, 0); \
\
if (__builtin_expect (__val > 1, 0)) \
lll_futex_wake (__futex, 1, private); \
}))
#define lll_unlock(futex, private) __lll_unlock(&(futex), private)
#define __lll_robust_unlock(futex, private) \
((void) ({ \
int *__futex = (futex); \
int __val = atomic_exchange_rel (__futex, 0); \
\
if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
lll_futex_wake (__futex, 1, private); \
}))
#define lll_robust_unlock(futex, private) \
__lll_robust_unlock(&(futex), private)
#define lll_islocked(futex) \
(futex != 0)
/* Initializers for lock. */
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
/* The kernel notifies a process with uses CLONE_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero
afterwards. */
#define lll_wait_tid(tid) \
do \
{ \
__typeof (tid) __tid; \
while ((__tid = (tid)) != 0) \
lll_futex_wait (&(tid), __tid, LLL_SHARED); \
} \
while (0)
extern int __lll_timedwait_tid (int *, const struct timespec *)
attribute_hidden;
#define lll_timedwait_tid(tid, abstime) \
({ \
int __res = 0; \
if ((tid) != 0) \
__res = __lll_timedwait_tid (&(tid), (abstime)); \
__res; \
})
#endif /* lowlevellock.h */

View File

@ -1,50 +0,0 @@
/* Special .init and .fini section support for ia64. NPTL version.
Copyright (C) 2000, 2001, 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
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,
write to the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This file is compiled into assembly code which is then munged by a sed
script into two files: crti.s and crtn.s.
* crti.s puts a function prologue at the beginning of the
.init and .fini sections and defines global symbols for
those addresses, so they can be called as functions.
* crtn.s puts the corresponding function epilogues
in the .init and .fini sections. */
#include <stddef.h>
__asm__ ("\n\
#include \"defs.h\"\n\
\n\
/*@HEADER_ENDS*/\n\
\n\
/*@_init_PROLOG_BEGINS*/\n\
.xdata8 \".init_array\",@fptr(__pthread_initialize_minimal_internal)\n\
/*@_init_PROLOG_ENDS*/\n\
");

View File

@ -1,60 +0,0 @@
/* Copyright (C) 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; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#define _SIGNAL_H
#include <bits/signum.h>
#include <tcb-offsets.h>
/* The following are defined in linux/sched.h, which unfortunately */
/* is not safe for inclusion in an assembly file. */
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
/* pid_t vfork(void); */
/* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */
ENTRY(__vfork)
.prologue // work around a GAS bug which triggers if
.body // first .prologue is not at the beginning of proc.
alloc r2=ar.pfs,0,0,2,0
adds r14=PID,r13
;;
ld4 r16=[r14]
;;
sub r15=0,r16
mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
mov out1=0 /* Standard sp value. */
;;
st4 [r14]=r15
DO_CALL (SYS_ify (clone))
cmp.eq p0,p7=0,r8
adds r14=PID,r13
;;
(p7) ld4 r16=[r14]
cmp.eq p6,p0=-1,r10
;;
(p7) sub r15=0,r16
;;
(p7) st4 [r14]=r15
(p6) br.cond.spnt.few __syscall_error
ret
PSEUDO_END(__vfork)
weak_alias (__vfork, vfork)

View File

@ -1,94 +0,0 @@
/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "pthreadP.h"
#include <lowlevellock.h>
unsigned long int __fork_generation attribute_hidden;
static void
clear_once_control (void *arg)
{
pthread_once_t *once_control = (pthread_once_t *) arg;
*once_control = 0;
lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
}
int
__pthread_once (once_control, init_routine)
pthread_once_t *once_control;
void (*init_routine) (void);
{
while (1)
{
int oldval, val, newval;
val = *once_control;
do
{
/* Check if the initialized has already been done. */
if ((val & 2) != 0)
return 0;
oldval = val;
newval = (oldval & 3) | __fork_generation | 1;
val = atomic_compare_and_exchange_val_acq (once_control, newval,
oldval);
}
while (__builtin_expect (val != oldval, 0));
/* Check if another thread already runs the initializer. */
if ((oldval & 1) != 0)
{
/* Check whether the initializer execution was interrupted
by a fork. */
if (((oldval ^ newval) & -4) == 0)
{
/* Same generation, some other thread was faster. Wait. */
lll_futex_wait (once_control, newval, LLL_PRIVATE);
continue;
}
}
/* This thread is the first here. Do the initialization.
Register a cleanup handler so that in case the thread gets
interrupted the initialization can be restarted. */
pthread_cleanup_push (clear_once_control, once_control);
init_routine ();
pthread_cleanup_pop (0);
/* Add one to *once_control. */
atomic_increment (once_control);
/* Wake up all other threads. */
lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
break;
}
return 0;
}
weak_alias (__pthread_once, pthread_once)
strong_alias (__pthread_once, __pthread_once_internal)

View File

@ -1,205 +0,0 @@
/* Copyright (C) 2002, 2003, 2004, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <tls.h>
#ifndef __ASSEMBLER__
# include <nptl/pthreadP.h>
#endif
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
# undef PSEUDO
# ifndef NOT_IN_libc
# define SYSDEP_CANCEL_ERRNO __libc_errno
# else
# define SYSDEP_CANCEL_ERRNO errno
# endif
# define SYSDEP_CANCEL_ERROR(args) \
.section .gnu.linkonce.t.__syscall_error_##args, "ax"; \
.align 32; \
.proc __syscall_error_##args; \
.global __syscall_error_##args; \
.hidden __syscall_error_##args; \
.size __syscall_error_##args, 64; \
__syscall_error_##args: \
.prologue; \
.regstk args, 5, args, 0; \
.save ar.pfs, loc0; \
.save rp, loc1; \
.body; \
addl loc4 = @ltoff(@tprel(SYSDEP_CANCEL_ERRNO)), gp;; \
ld8 loc4 = [loc4]; \
mov rp = loc1;; \
mov r8 = -1; \
add loc4 = loc4, r13;; \
st4 [loc4] = loc3; \
mov ar.pfs = loc0
# ifndef USE_DL_SYSINFO
# define PSEUDO(name, syscall_name, args) \
.text; \
ENTRY (name) \
adds r14 = MULTIPLE_THREADS_OFFSET, r13;; \
ld4 r14 = [r14]; \
mov r15 = SYS_ify(syscall_name);; \
cmp4.ne p6, p7 = 0, r14; \
(p6) br.cond.spnt .Lpseudo_cancel;; \
break __BREAK_SYSCALL;; \
cmp.eq p6,p0=-1,r10; \
(p6) br.cond.spnt.few __syscall_error; \
ret;; \
.endp name; \
.proc __GC_##name; \
.globl __GC_##name; \
.hidden __GC_##name; \
__GC_##name: \
.Lpseudo_cancel: \
.prologue; \
.regstk args, 5, args, 0; \
.save ar.pfs, loc0; \
alloc loc0 = ar.pfs, args, 5, args, 0; \
.save rp, loc1; \
mov loc1 = rp;; \
.body; \
CENABLE;; \
mov loc2 = r8; \
COPY_ARGS_##args \
mov r15 = SYS_ify(syscall_name); \
break __BREAK_SYSCALL;; \
mov loc3 = r8; \
mov loc4 = r10; \
mov out0 = loc2; \
CDISABLE;; \
cmp.eq p6,p0=-1,loc4; \
(p6) br.cond.spnt.few __syscall_error_##args; \
mov r8 = loc3; \
mov rp = loc1; \
mov ar.pfs = loc0; \
.Lpseudo_end: \
ret; \
.endp __GC_##name; \
SYSDEP_CANCEL_ERROR(args)
# else /* USE_DL_SYSINFO */
# define PSEUDO(name, syscall_name, args) \
.text; \
ENTRY (name) \
.prologue; \
adds r2 = SYSINFO_OFFSET, r13; \
adds r14 = MULTIPLE_THREADS_OFFSET, r13; \
.save ar.pfs, r11; \
mov r11 = ar.pfs;; \
.body; \
ld4 r14 = [r14]; \
ld8 r2 = [r2]; \
mov r15 = SYS_ify(syscall_name);; \
cmp4.ne p6, p7 = 0, r14; \
mov b7 = r2; \
(p6) br.cond.spnt .Lpseudo_cancel; \
br.call.sptk.many b6 = b7;; \
mov ar.pfs = r11; \
cmp.eq p6,p0 = -1, r10; \
(p6) br.cond.spnt.few __syscall_error; \
ret;; \
.endp name; \
.proc __GC_##name; \
.globl __GC_##name; \
.hidden __GC_##name; \
__GC_##name: \
.Lpseudo_cancel: \
.prologue; \
.regstk args, 5, args, 0; \
.save ar.pfs, loc0; \
alloc loc0 = ar.pfs, args, 5, args, 0; \
adds loc4 = SYSINFO_OFFSET, r13; \
.save rp, loc1; \
mov loc1 = rp;; \
.body; \
ld8 loc4 = [loc4]; \
CENABLE;; \
mov loc2 = r8; \
mov b7 = loc4; \
COPY_ARGS_##args \
mov r15 = SYS_ify(syscall_name); \
br.call.sptk.many b6 = b7;; \
mov loc3 = r8; \
mov loc4 = r10; \
mov out0 = loc2; \
CDISABLE;; \
cmp.eq p6,p0=-1,loc4; \
(p6) br.cond.spnt.few __syscall_error_##args; \
mov r8 = loc3; \
mov rp = loc1; \
mov ar.pfs = loc0; \
.Lpseudo_end: \
ret; \
.endp __GC_##name; \
SYSDEP_CANCEL_ERROR(args)
# endif /* USE_DL_SYSINFO */
# undef PSEUDO_END
# define PSEUDO_END(name) .endp
# ifdef IS_IN_libpthread
# define CENABLE br.call.sptk.many b0 = __pthread_enable_asynccancel
# define CDISABLE br.call.sptk.many b0 = __pthread_disable_asynccancel
# elif !defined NOT_IN_libc
# define CENABLE br.call.sptk.many b0 = __libc_enable_asynccancel
# define CDISABLE br.call.sptk.many b0 = __libc_disable_asynccancel
# elif defined IS_IN_librt
# define CENABLE br.call.sptk.many b0 = __librt_enable_asynccancel
# define CDISABLE br.call.sptk.many b0 = __librt_disable_asynccancel
# else
# error Unsupported library
# endif
# define COPY_ARGS_0 /* Nothing */
# define COPY_ARGS_1 COPY_ARGS_0 mov out0 = in0;
# define COPY_ARGS_2 COPY_ARGS_1 mov out1 = in1;
# define COPY_ARGS_3 COPY_ARGS_2 mov out2 = in2;
# define COPY_ARGS_4 COPY_ARGS_3 mov out3 = in3;
# define COPY_ARGS_5 COPY_ARGS_4 mov out4 = in4;
# define COPY_ARGS_6 COPY_ARGS_5 mov out5 = in5;
# define COPY_ARGS_7 COPY_ARGS_6 mov out6 = in6;
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0, 1)
# else
# define SINGLE_THREAD_P \
adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
# endif
#elif !defined __ASSEMBLER__
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
#ifndef __ASSEMBLER__
# define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
#endif

View File

@ -1 +0,0 @@
#include "../x86_64/timer_create.c"

View File

@ -1 +0,0 @@
#include "../x86_64/timer_delete.c"

View File

@ -1 +0,0 @@
#include "../x86_64/timer_getoverr.c"

View File

@ -1 +0,0 @@
#include "../x86_64/timer_gettime.c"

View File

@ -1 +0,0 @@
#include "../x86_64/timer_settime.c"

View File

@ -1,39 +0,0 @@
/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>.
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,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <dlfcn.h>
#include <stdio.h>
#include <unwind.h>
#include <pthreadP.h>
static _Unwind_Word (*libgcc_s_getbsp) (struct _Unwind_Context *);
#define ARCH_CANCEL_INIT(handle) \
((libgcc_s_getbsp = __libc_dlsym (handle, "_Unwind_GetBSP")) == NULL)
#include <sysdeps/pthread/unwind-forcedunwind.c>
_Unwind_Word
_Unwind_GetBSP (struct _Unwind_Context *context)
{
if (__builtin_expect (libgcc_s_getbsp == NULL, 0))
pthread_cancel_init ();
return libgcc_s_getbsp (context);
}

View File

@ -1,44 +0,0 @@
/* Copyright (C) 1991,92,94,95,97,98,2000,02,04 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <stddef.h>
#include <setjmp.h>
#include <signal.h>
#include <pthreadP.h>
#include <jmpbuf-unwind.h>
extern void __sigstack_longjmp (__jmp_buf, int)
__attribute__ ((noreturn));
/* Like __libc_siglongjmp(), but safe for crossing from alternate
signal stack to normal stack. Needed by NPTL. */
void
__libc_unwind_longjmp (sigjmp_buf env, int val)
{
/* Perform any cleanups needed by the frames being unwound. */
__pthread_cleanup_upto (env->__jmpbuf, CURRENT_STACK_FRAME);
if (env[0].__mask_was_saved)
/* Restore the saved signal mask. */
(void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
(sigset_t *) NULL);
/* Call the machine-dependent function to restore machine state. */
__sigstack_longjmp (env[0].__jmpbuf, val ?: 1);
}
hidden_def (__libc_unwind_longjmp)

View File

@ -1,69 +0,0 @@
/* Copyright (C) 2000, 2002, 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; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#define _SIGNAL_H
#include <bits/signum.h>
#include <tcb-offsets.h>
/* The following are defined in linux/sched.h, which unfortunately */
/* is not safe for inclusion in an assembly file. */
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
/* pid_t vfork(void); */
/* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */
ENTRY(__vfork)
.prologue // work around a GAS bug which triggers if
.body // first .prologue is not at the beginning of proc.
alloc r2=ar.pfs,0,0,2,0
adds r14=PID,r13
;;
ld4 r16=[r14]
;;
sub r15=0,r16
cmp.eq p6,p0=0,r16
;;
(p6) movl r15=0x80000000
mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
mov out1=0 /* Standard sp value. */
;;
st4 [r14]=r15
DO_CALL (SYS_ify (clone))
cmp.eq p6,p0=0,r8
adds r14=PID,r13
(p6) br.cond.dptk 1f
;;
ld4 r15=[r14]
;;
extr.u r16=r15,0,31
;;
cmp.eq p0,p6=0,r16
;;
(p6) sub r16=0,r15
;;
st4 [r14]=r16
1:
cmp.eq p6,p0=-1,r10
(p6) br.cond.spnt.few __syscall_error
ret
PSEUDO_END(__vfork)
libc_hidden_def (__vfork)
weak_alias (__vfork, vfork)