Fix more namespace issues in sys/ucontext.h (bug 21457).
[glibc.git] / sysdeps / ia64 / tls-macros.h
blob13b216d85dc31221f6cb9d79ed4f0314d0c02853
1 /* Macros to support TLS testing in times of missing compiler support. */
3 extern void *__tls_get_addr (void *);
5 # define TLS_LE(x) \
6 ({ void *__l; \
7 asm ("mov r2=r13\n\t" \
8 ";;\n\t" \
9 "addl %0=@tprel(" #x "),r2\n\t" \
10 : "=r" (__l) : : "r2" ); __l; })
12 # define TLS_IE(x) \
13 ({ void *__l; \
14 register long __gp asm ("gp"); \
15 asm (";;\n\t" \
16 "addl r16=@ltoff(@tprel(" #x ")),gp\n\t" \
17 ";;\n\t" \
18 "ld8 r17=[r16]\n\t" \
19 ";;\n\t" \
20 "add %0=r13,r17\n\t" \
21 ";;\n\t" \
22 : "=r" (__l) : "r" (__gp) : "r16", "r17" ); __l; })
24 # define __TLS_CALL_CLOBBERS \
25 "r2", "r3", "r8", "r9", "r10", "r11", "r14", "r15", "r16", "r17", \
26 "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", \
27 "r27", "r28", "r29", "r30", "r31", \
28 "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \
29 "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
30 "b6", "b7", \
31 "out0", "out1", "out2", "out3", "out4", "out5", "out6", "out7"
33 # define TLS_LD(x) \
34 ({ void *__l; \
35 register long __gp asm ("gp"); \
36 asm (";;\n\t" \
37 "mov loc0=gp\n\t" \
38 "addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t" \
39 "addl out1=@dtprel(" #x "),r0\n\t" \
40 ";;\n\t" \
41 "ld8 out0=[r16]\n\t" \
42 "br.call.sptk.many b0=__tls_get_addr" \
43 ";;\n\t" \
44 "mov gp=loc0\n\t" \
45 "mov %0=r8\n\t" \
46 ";;\n\t" \
47 : "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS); \
48 __l; })
50 # define TLS_GD(x) \
51 ({ void *__l; \
52 register long __gp asm ("gp"); \
53 asm (";;\n\t" \
54 "mov loc0=gp\n\t" \
55 "addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t" \
56 "addl r17=@ltoff(@dtprel(" #x ")),gp\n\t" \
57 ";;\n\t" \
58 "ld8 out0=[r16]\n\t" \
59 "ld8 out1=[r17]\n\t" \
60 "br.call.sptk.many b0=__tls_get_addr" \
61 ";;\n\t" \
62 "mov gp=loc0\n\t" \
63 "mov %0=r8\n\t" \
64 ";;\n\t" \
65 : "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS); \
66 __l; })