]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/aarch64/tls-macros.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / aarch64 / tls-macros.h
CommitLineData
04277e02 1/* Copyright (C) 2009-2019 Free Software Foundation, Inc.
554066b8
MS
2
3 This file is part of the GNU C Library.
4
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 License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
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.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
554066b8
MS
18
19#define TLS_LD(x) TLS_GD(x)
20
21#define TLS_GD(x) \
22 ({ register unsigned long __result asm ("x0"); \
23 asm ("adrp %0, :tlsgd:" #x "; " \
24 "add %0, %0, #:tlsgd_lo12:" #x "; " \
25 "bl __tls_get_addr;" \
26 "nop" \
27 : "=r" (__result) \
28 : \
29 : "x1", "x2", "x3", "x4", "x5", "x6", \
30 "x7", "x8", "x9", "x10", "x11", "x12", \
31 "x13", "x14", "x15", "x16", "x17", "x18", \
265a9b73 32 "x30", "memory", "cc"); \
554066b8
MS
33 (int *) (__result); })
34
35#define TLS_IE(x) \
36 ({ register unsigned long __result asm ("x0"); \
37 register unsigned long __t; \
38 asm ("mrs %1, tpidr_el0; " \
39 "adrp %0, :gottprel:" #x "; " \
40 "ldr %0, [%0, #:gottprel_lo12:" #x "]; " \
41 "add %0, %0, %1" \
42 : "=r" (__result), "=r" (__t)); \
43 (int *) (__result); })
44
45#define TLS_LE(x) \
46 ({ register unsigned long __result asm ("x0"); \
47 asm ("mrs %0, tpidr_el0; " \
48 "add %0, %0, :tprel_hi12:" #x "; " \
49 "add %0, %0, :tprel_lo12_nc:" #x \
50 : "=r" (__result)); \
51 (int *) (__result); })