Update copyright notices with scripts/update-copyrights
[glibc.git] / nptl / sysdeps / x86_64 / x32 / tls.h
blob7060616a5c8c90a8c249e47992ba3080a102a486
1 /* Definition for thread-local data handling. nptl/x32 version.
2 Copyright (C) 2012-2014 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, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _X32_TLS_H
20 #define _X32_TLS_H 1
22 #include <sysdeps/x86_64/tls.h>
24 #ifndef __ASSEMBLER__
26 /* X32 doesn't support 32-bit indirect calls via memory. Instead, we
27 load the 32-bit address from memory into the lower 32 bits of the
28 return-value register, which will automatically zero-extend the upper
29 32 bits of the return-value register. We then do the indirect call
30 via the 64-bit return-value register. */
31 # undef CALL_THREAD_FCT
32 # define CALL_THREAD_FCT(descr) \
33 ({ void *__res; \
34 asm volatile ("movl %%fs:%P2, %%edi\n\t" \
35 "movl %%fs:%P1, %k0\n\t" \
36 "callq *%q0" \
37 : "=a" (__res) \
38 : "i" (offsetof (struct pthread, start_routine)), \
39 "i" (offsetof (struct pthread, arg)) \
40 : "di", "si", "cx", "dx", "r8", "r9", "r10", "r11", \
41 "memory", "cc"); \
42 __res; })
44 #endif /* __ASSEMBLER__ */
46 #endif /* x32/tls.h */