From 468777e1d0dbd6cb8bcaee244a954824d5c84167 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 25 Apr 2003 22:28:13 +0000 Subject: Update. * pthread.c (__pthread_initialize_manager): Subtract TLS_PRE_TCB_SIZE bytes from tcbp to get to descr. * manager.c (pthread_handle_create): Subtract or add TLS_PRE_TCB_SIZE instead of sizeof (pthread_descr). (pthread_free): Add TLS_PRE_TCB_SIZE instead of sizeof (pthread_descr). * sysdeps/powerpc/tls.h (TLS_INIT_TCB_SIZE, TLS_TCB_SIZE): Define to 0. --- nptl/sysdeps/powerpc/tcb-offsets.sym | 11 ++++++++++- nptl/sysdeps/powerpc/tls.h | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'nptl/sysdeps/powerpc') diff --git a/nptl/sysdeps/powerpc/tcb-offsets.sym b/nptl/sysdeps/powerpc/tcb-offsets.sym index 58ee03072e..d6b7560b8e 100644 --- a/nptl/sysdeps/powerpc/tcb-offsets.sym +++ b/nptl/sysdeps/powerpc/tcb-offsets.sym @@ -1,4 +1,13 @@ #include #include -MULTIPLE_THREADS_OFFSET ((void *) &p_multiple_threads ((struct pthread) ((void *) 0 - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)) - (void *) 0) +-- + +-- Abuse tls.h macros to derive offsets relative to the thread register. +# undef __thread_register +# define __thread_register ((void *) 0) +# define thread_offsetof(mem) ((void *) &THREAD_SELF->mem - (void *) 0) + +#if TLS_MULTIPLE_THREADS_IN_TCB +MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) +#endif diff --git a/nptl/sysdeps/powerpc/tls.h b/nptl/sysdeps/powerpc/tls.h index e3e0424fe0..6573bb6b04 100644 --- a/nptl/sysdeps/powerpc/tls.h +++ b/nptl/sysdeps/powerpc/tls.h @@ -81,7 +81,9 @@ typedef struct # define TLS_TCB_ALIGN __alignof__ (struct pthread) /* This is the size we need before TCB. */ -# define TLS_PRE_TCB_SIZE (sizeof (struct pthread) + 32) +# define TLS_PRE_TCB_SIZE \ + (sizeof (struct pthread) \ + + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1))) # ifndef __powerpc64__ /* Register r2 (tp) is reserved by the ABI as "thread pointer". */ -- cgit v1.2.1