1 /* Copyright (C) 2011-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
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/>. */
20 #define TLS_GD_OFFSET(x) \
21 "moveli r0, hw1_last_tls_gd(" #x ")\n\t" \
22 "shl16insli r0, r0, hw0_tls_gd(" #x ")\n\t" \
23 "addi r0, %1, tls_add(" #x ")\n\t"
25 #define TLS_GD_OFFSET(x) \
26 "auli r0, %1, tls_gd_ha16(" #x ")\n\t" \
27 "addli r0, r0, tls_gd_lo16(" #x ")\n\t"
33 extern char _GLOBAL_OFFSET_TABLE_[]; \
35 asm (TLS_GD_OFFSET(x) \
36 "jal tls_gd_call(" #x ")\n\t" \
37 "addi %0, r0, tls_gd_add(" #x ")" : \
38 "=&r" (__retval) : "r" (_GLOBAL_OFFSET_TABLE_) : \
39 "r0", "r25", "r26", "r27", "r28", "r29"); \
42 /* No special support for LD mode. */
46 #define TLS_IE_OFFSET(x) \
47 "moveli %0, hw1_last_tls_ie(" #x ")\n\t" \
48 "shl16insli %0, %0, hw0_tls_ie(" #x ")\n\t" \
49 "addi %0, %1, tls_add(" #x ")\n\t"
50 #define LD_TLS "ld_tls"
52 #define TLS_IE_OFFSET(x) \
53 "auli %0, %1, tls_ie_ha16(" #x ")\n\t" \
54 "addli %0, %0, tls_ie_lo16(" #x ")\n\t"
55 #define LD_TLS "lw_tls"
61 extern char _GLOBAL_OFFSET_TABLE_[]; \
63 asm (TLS_IE_OFFSET(x) \
64 LD_TLS " %0, %0, tls_ie_load(" #x ")\n\t" \
66 "=&r" (__retval) : "r" (_GLOBAL_OFFSET_TABLE_)); \
71 "moveli %0, hw1_last_tls_le(" #x ")\n\t" \
72 "shl16insli %0, %0, hw0_tls_le(" #x ")\n\t" \
76 "auli %0, tp, tls_le_ha16(" #x ")\n\t" \
77 "addli %0, %0, tls_le_lo16(" #x ")\n\t"
83 asm (_TLS_LE(x) : "=r" (__retval)); \