conformtest: clean up POSIX expectations for unistd.h.
[glibc.git] / sysdeps / hppa / tls-macros.h
blob38edb1b72c4e02bd1d7edc550cd7c05c91b65c70
1 /* TLS Access Macros for HP PARISC Linux */
3 /* HPPA Local Exec TLS access. */
4 #define TLS_LE(x) \
5 ({ int * __result; \
6 unsigned long __tmp; \
7 asm ( \
8 " mfctl %%cr27, %1\n" \
9 " addil LR'" #x "-$tls_leoff$, %1\n" \
10 " ldo RR'" #x "-$tls_leoff$(%%r1), %0\n" \
11 : "=r" (__result), "=r" (__tmp) \
12 : \
13 : "r1" ); \
14 __result; \
17 /* HPPA Initial Exec TLS access. */
18 #ifdef PIC
19 # define TLS_IE(x) \
20 ({ int * __result; \
21 unsigned long __tmp, __tmp2; \
22 asm ( \
23 " mfctl %%cr27, %1\n" \
24 " addil LT'" #x "-$tls_ieoff$, %%r19\n" \
25 " ldw RT'" #x "-$tls_ieoff$(%%r1), %2\n" \
26 " add %1, %2, %0\n" \
27 : "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
28 : \
29 : "r1" ); \
30 __result; \
32 #else
33 # define TLS_IE(x) \
34 ({ int * __result; \
35 unsigned long __tmp, __tmp2; \
36 asm ( \
37 " mfctl %%cr27, %1\n" \
38 " addil LR'" #x "-$tls_ieoff$, %%r27\n" \
39 " ldw RR'" #x "-$tls_ieoff$(%%r1), %2\n" \
40 " add %1, %2, %0\n" \
41 : "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
42 : \
43 : "r1" ); \
44 __result; \
46 #endif
48 #ifdef PIC
49 /* HPPA Local Dynamic TLS access. */
50 # define TLS_LD(x) \
51 ({ int * __result; \
52 asm ( \
53 " copy %%r19, %%r4\n" \
54 " addil LT'" #x "-$tls_ldidx$, %%r19\n" \
55 " bl __tls_get_addr, %%r2\n" \
56 " ldo RT'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
57 " addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
58 " ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
59 " copy %%r4, %%r19\n" \
60 : "=r" (__result) \
61 : \
62 : "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
63 "r25", "r26", "r28", "r29", "r31" ); \
64 __result; \
66 #else
67 # define TLS_LD(x) \
68 ({ int * __result; \
69 asm ( \
70 " addil LR'" #x "-$tls_ldidx$, %%r27\n" \
71 " bl __tls_get_addr, %%r2\n" \
72 " ldo RR'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
73 " addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
74 " ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
75 : "=r" (__result) \
76 : \
77 : "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
78 "r25", "r26", "r28", "r29", "r31" ); \
79 __result; \
81 #endif
83 /* HPPA General Dynamic TLS access. */
84 #ifdef PIC
85 # define TLS_GD(x) \
86 ({ int * __result; \
87 asm ( \
88 " copy %%r19, %%r4\n" \
89 " addil LT'" #x "-$tls_gdidx$, %%r19\n" \
90 " bl __tls_get_addr, %%r2\n" \
91 " ldo RT'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
92 " copy %%r28, %0\n" \
93 " copy %%r4, %%r19\n" \
94 : "=r" (__result) \
95 : \
96 : "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
97 "r25", "r26", "r28", "r29", "r31" ); \
98 __result; \
100 #else
101 # define TLS_GD(x) \
102 ({ int * __result; \
103 asm ( \
104 " addil LR'" #x "-$tls_gdidx$, %%r27\n" \
105 " bl __tls_get_addr, %%r2\n" \
106 " ldo RR'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
107 " copy %%r28, %0\n" \
108 : "=r" (__result) \
110 : "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
111 "r25", "r26", "r28", "r29", "r31" ); \
112 __result; \
114 #endif