Index: allocatestack.c =================================================================== RCS file: /home/ianw/cvs/nptl/allocatestack.c,v retrieving revision 1.1.1.3 retrieving revision 1.5 diff -u -r1.1.1.3 -r1.5 Index: descr.h =================================================================== RCS file: /home/ianw/cvs/nptl/descr.h,v retrieving revision 1.1.1.3 retrieving revision 1.7 diff -u -r1.1.1.3 -r1.7 --- descr.h 3 Apr 2003 01:02:57 -0000 1.1.1.3 +++ descr.h 7 Apr 2003 02:54:09 -0000 1.7 @@ -62,10 +62,16 @@ #if !TLS_DTV_AT_TP /* This overlaps the TCB as used for TLS without threads (see tls.h). */ tcbhead_t header; -#elif TLS_MULTIPLE_THREADS_IN_TCB + /* For arch's who don't have room in the TCB */ +#elif (TLS_MULTIPLE_THREADS_IN_TCB || TLS_SYSINFO_IN_TCB) struct { + #if TLS_MULTIPLE_THREADS_IN_TCB int multiple_threads; + #endif + #if TLS_SYSINFO_IN_TCB + uintptr_t sysinfo; + #endif } header; #endif Index: sysdeps/ia64/tcb-offsets.sym =================================================================== RCS file: /home/ianw/cvs/nptl/sysdeps/ia64/tcb-offsets.sym,v retrieving revision 1.1.1.2 retrieving revision 1.5 diff -u -r1.1.1.2 -r1.5 --- sysdeps/ia64/tcb-offsets.sym 31 Mar 2003 00:07:19 -0000 1.1.1.2 +++ sysdeps/ia64/tcb-offsets.sym 7 Apr 2003 02:54:09 -0000 1.5 @@ -2,3 +2,7 @@ #include MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - sizeof (struct pthread) + +#ifdef TLS_SYSINFO_IN_TCB +SYSINFO_OFFSET offsetof (struct pthread, header.sysinfo) - sizeof (struct pthread) +#endif Index: sysdeps/ia64/tls.h =================================================================== RCS file: /home/ianw/cvs/nptl/sysdeps/ia64/tls.h,v retrieving revision 1.1.1.1 retrieving revision 1.6 diff -u -r1.1.1.1 -r1.6 --- sysdeps/ia64/tls.h 31 Mar 2003 00:06:49 -0000 1.1.1.1 +++ sysdeps/ia64/tls.h 7 Apr 2003 02:54:09 -0000 1.6 @@ -27,6 +27,22 @@ # include # include +/* TLS LAYOUT + + The IA64 ABI specifies that after the thread pointer there is a + pointer to the DTV and a private pointer. Consequently in NPTL the + thread descriptor is placed directly before the thread pointer (this + is significantly cleaner than using indirection with the private + pointer). + + [struct pthread][dtv][private][static tls block] + tp (r13)----^ + [ in descr.h ][ tcbhead_t ] + + Note that space is made for the descriptor during TLS setup with the + use of TCB_PRE_TCB_SIZE. + +*/ /* Type for the dtv. */ typedef union dtv @@ -35,14 +51,16 @@ void *pointer; } dtv_t; - typedef struct { dtv_t *dtv; void *private; } tcbhead_t; +/* As TCB_DTV_AT_TP doesn't allow us more room in the tcbhead defined + above, we have extra pointers in our thread descriptor. */ # define TLS_MULTIPLE_THREADS_IN_TCB 1 +# define TLS_SYSINFO_IN_TCB 1 #else /* __ASSEMBLER__ */ # include @@ -100,11 +118,21 @@ # define GET_DTV(descr) \ (((tcbhead_t *) (descr))->dtv) +/* The room for the thread descriptor is allocated thanks to setting + TLS_PRE_TCB_SIZE so we are safe set this here */ +#if NEED_DL_SYSINFO +# define INIT_SYSINFO \ + THREAD_SELF->header.sysinfo = GL(dl_sysinfo) +#else +# define INIT_SYSINFO +#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), NULL) + operation can cause a failure 'errno' must not be touched. This + should return a string error, but we really can't fail */ +#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() \ Index: sysdeps/pthread/createthread.c =================================================================== RCS file: /home/ianw/cvs/nptl/sysdeps/pthread/createthread.c,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- sysdeps/pthread/createthread.c 31 Mar 2003 00:13:16 -0000 1.1.1.3 +++ sysdeps/pthread/createthread.c 7 Apr 2003 02:54:09 -0000 1.4 @@ -113,7 +113,7 @@ } } -#ifdef NEED_DL_SYSINFO +#ifdef NEED_DL_SYSINFO assert (THREAD_GETMEM (THREAD_SELF, header.sysinfo) == pd->header.sysinfo); #endif Index: sysdeps/unix/sysv/linux/ia64/dl-sysdep.h =================================================================== RCS file: sysdeps/unix/sysv/linux/ia64/dl-sysdep.h diff -N sysdeps/unix/sysv/linux/ia64/dl-sysdep.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sysdeps/unix/sysv/linux/ia64/dl-sysdep.h 31 Mar 2003 00:12:36 -0000 1.1 @@ -0,0 +1,44 @@ +/* System-specific settings for dynamic linker code. IA-64 version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger + + 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 + +#define NEED_DL_SYSINFO 1 + +#ifndef __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"); +#endif + +#endif /* dl-sysdep.h */ Index: sysdeps/unix/sysv/linux/ia64/lowlevellock.h =================================================================== RCS file: /home/ianw/cvs/nptl/sysdeps/unix/sysv/linux/ia64/lowlevellock.h,v retrieving revision 1.1.1.4 retrieving revision 1.2 diff -u -r1.1.1.4 -r1.2