source:
pkg/security/vinnie/main/eglibc/trunk/debian/patches/amd64/local-linuxthreads-gscope.diff
@
6973
| Revision 6973, 2.1 KB checked in by alanbach-guest, 3 years ago (diff) |
|---|
-
linuxthreads/sysdeps/x86_64/tls.h
--- linuxthreads/sysdeps/x86_64/tls.h | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
a b 49 49 uintptr_t sysinfo; 50 50 uintptr_t stack_guard; 51 51 uintptr_t pointer_guard; 52 # ifdef __FreeBSD_kernel__ 53 long gscope_flag; 54 # else 55 int gscope_flag; 56 # endif 52 57 } tcbhead_t; 53 58 54 59 #else /* __ASSEMBLER__ */ … … 147 152 ((descr)->p_header.data.pointer_guard \ 148 153 = THREAD_GETMEM (THREAD_SELF, p_header.data.pointer_guard)) 149 154 155 /* Get and set the global scope generation counter in the TCB head. */ 156 #define THREAD_GSCOPE_FLAG_UNUSED 0 157 #define THREAD_GSCOPE_FLAG_USED 1 158 #define THREAD_GSCOPE_FLAG_WAIT 2 159 #ifdef __FreeBSD_kernel__ 160 # define THREAD_GSCOPE_RESET_FLAG() \ 161 do \ 162 { int __res; \ 163 asm volatile ("xchgl %0, %%fs:%P1" \ 164 : "=r" (__res) \ 165 : "i" (offsetof (struct _pthread_descr_struct, p_gscope_flag)), \ 166 "0" (THREAD_GSCOPE_FLAG_UNUSED)); \ 167 if (__res == THREAD_GSCOPE_FLAG_WAIT) \ 168 lll_futex_wake (&THREAD_SELF->p_gscope_flag, 1); \ 169 } \ 170 while (0) 171 #else 172 /* As the FreeBSD kernel defines futex as long (compared to int with 173 a Linux kernel), we need to use xchgq instead of xchgl to handle 174 the gscope_flag variable. */ 175 # define THREAD_GSCOPE_RESET_FLAG() \ 176 do \ 177 { long __res; \ 178 asm volatile ("xchgq %0, %%fs:%P1" \ 179 : "=r" (__res) \ 180 : "i" (offsetof (struct _pthread_descr_struct, p_gscope_flag)), \ 181 "0" (THREAD_GSCOPE_FLAG_UNUSED)); \ 182 if (__res == THREAD_GSCOPE_FLAG_WAIT) \ 183 lll_futex_wake (&THREAD_SELF->p_gscope_flag, 1); \ 184 } \ 185 while (0) 186 #endif /* __FreeBSD_kernel__ */ 187 #define THREAD_GSCOPE_SET_FLAG() \ 188 THREAD_SETMEM (THREAD_SELF, p_gscope_flag, THREAD_GSCOPE_FLAG_USED) 189 #define THREAD_GSCOPE_WAIT() \ 190 do { /* GL(dl_wait_lookup_done) () */ } while (0) 191 150 192 # endif /* HAVE_TLS_SUPPORT */ 151 193 #endif /* __ASSEMBLER__ */ 152 194
Note: See TracBrowser
for help on using the repository browser.


