* sysdeps/powerpc/powerpc32/fpu/s_ceil.S (TWO52.0): Delete.
[glibc.git] / nptl / sysdeps / sparc / tls.h
blob54b54859d9b72fd226b61ca429cdfe1e0351c639
1 /* Definitions for thread-local data handling. NPTL/sparc version.
2 Copyright (C) 2003, 2005 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _TLS_H
21 #define _TLS_H
23 #include <dl-sysdep.h>
24 #ifndef __ASSEMBLER__
25 # include <stdbool.h>
26 # include <stddef.h>
27 # include <stdint.h>
28 # include <stdlib.h>
29 # include <list.h>
31 /* Type for the dtv. */
32 typedef union dtv
34 size_t counter;
35 struct
37 void *val;
38 bool is_static;
39 } pointer;
40 } dtv_t;
42 typedef struct
44 void *tcb; /* Pointer to the TCB. Not necessary the
45 thread descriptor used by libpthread. */
46 dtv_t *dtv;
47 void *self;
48 int multiple_threads;
49 } tcbhead_t;
51 #else /* __ASSEMBLER__ */
52 # include <tcb-offsets.h>
53 #endif /* __ASSEMBLER__ */
55 /* We require TLS support in the tools. */
56 #ifndef HAVE_TLS_SUPPORT
57 # error "TLS support is required."
58 #endif
60 /* Signal that TLS support is available. */
61 #define USE_TLS 1
63 #ifndef __ASSEMBLER__
64 /* Get system call information. */
65 # include <sysdep.h>
67 /* Get the thread descriptor definition. */
68 # include <nptl/descr.h>
70 register struct pthread *__thread_self __asm__("%g7");
72 /* This is the size of the initial TCB. Can't be just sizeof (tcbhead_t),
73 because NPTL getpid, __libc_alloca_cutoff etc. need (almost) the whole
74 struct pthread even when not linked with -lpthread. */
75 # define TLS_INIT_TCB_SIZE sizeof (struct pthread)
77 /* Alignment requirements for the initial TCB. */
78 # define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
80 /* This is the size of the TCB. */
81 # define TLS_TCB_SIZE sizeof (struct pthread)
83 /* Alignment requirements for the TCB. */
84 # define TLS_TCB_ALIGN __alignof__ (struct pthread)
86 /* The TCB can have any size and the memory following the address the
87 thread pointer points to is unspecified. Allocate the TCB there. */
88 # define TLS_TCB_AT_TP 1
90 /* Install the dtv pointer. The pointer passed is to the element with
91 index -1 which contain the length. */
92 # define INSTALL_DTV(descr, dtvp) \
93 ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
95 /* Install new dtv for current thread. */
96 # define INSTALL_NEW_DTV(DTV) \
97 (((tcbhead_t *) __thread_self)->dtv = (DTV))
99 /* Return dtv of given thread descriptor. */
100 # define GET_DTV(descr) \
101 (((tcbhead_t *) (descr))->dtv)
103 /* Code to initially initialize the thread pointer. */
104 # define TLS_INIT_TP(descr, secondcall) \
105 (__thread_self = (__typeof (__thread_self)) (descr), NULL)
107 /* Return the address of the dtv for the current thread. */
108 # define THREAD_DTV() \
109 (((tcbhead_t *) __thread_self)->dtv)
111 /* Return the thread descriptor for the current thread. */
112 #define THREAD_SELF __thread_self
114 /* Magic for libthread_db to know how to do THREAD_SELF. */
115 # define DB_THREAD_SELF_INCLUDE <sys/ucontext.h>
116 # define DB_THREAD_SELF \
117 REGISTER (32, 32, REG_G7 * 4, 0) REGISTER (64, 64, REG_G7 * 8, 0)
119 /* Access to data in the thread descriptor is easy. */
120 #define THREAD_GETMEM(descr, member) \
121 descr->member
122 #define THREAD_GETMEM_NC(descr, member, idx) \
123 descr->member[idx]
124 #define THREAD_SETMEM(descr, member, value) \
125 descr->member = (value)
126 #define THREAD_SETMEM_NC(descr, member, idx, value) \
127 descr->member[idx] = (value)
129 #endif /* !ASSEMBLER */
131 #endif /* tls.h */