|
Packit |
6c4009 |
/* Macros to support TLS testing in times of missing compiler support. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
extern void *__tls_get_addr (void *);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define TLS_LE(x) \
|
|
Packit |
6c4009 |
({ void *__l; \
|
|
Packit |
6c4009 |
asm ("mov r2=r13\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"addl %0=@tprel(" #x "),r2\n\t" \
|
|
Packit |
6c4009 |
: "=r" (__l) : : "r2" ); __l; })
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define TLS_IE(x) \
|
|
Packit |
6c4009 |
({ void *__l; \
|
|
Packit |
6c4009 |
register long __gp asm ("gp"); \
|
|
Packit |
6c4009 |
asm (";;\n\t" \
|
|
Packit |
6c4009 |
"addl r16=@ltoff(@tprel(" #x ")),gp\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"ld8 r17=[r16]\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"add %0=r13,r17\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
: "=r" (__l) : "r" (__gp) : "r16", "r17" ); __l; })
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define __TLS_CALL_CLOBBERS \
|
|
Packit |
6c4009 |
"r2", "r3", "r8", "r9", "r10", "r11", "r14", "r15", "r16", "r17", \
|
|
Packit |
6c4009 |
"r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", \
|
|
Packit |
6c4009 |
"r27", "r28", "r29", "r30", "r31", \
|
|
Packit |
6c4009 |
"p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \
|
|
Packit |
6c4009 |
"f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
|
|
Packit |
6c4009 |
"b6", "b7", \
|
|
Packit |
6c4009 |
"out0", "out1", "out2", "out3", "out4", "out5", "out6", "out7"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define TLS_LD(x) \
|
|
Packit |
6c4009 |
({ void *__l; \
|
|
Packit |
6c4009 |
register long __gp asm ("gp"); \
|
|
Packit |
6c4009 |
asm (";;\n\t" \
|
|
Packit |
6c4009 |
"mov loc0=gp\n\t" \
|
|
Packit |
6c4009 |
"addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t" \
|
|
Packit |
6c4009 |
"addl out1=@dtprel(" #x "),r0\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"ld8 out0=[r16]\n\t" \
|
|
Packit |
6c4009 |
"br.call.sptk.many b0=__tls_get_addr" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"mov gp=loc0\n\t" \
|
|
Packit |
6c4009 |
"mov %0=r8\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
: "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS); \
|
|
Packit |
6c4009 |
__l; })
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define TLS_GD(x) \
|
|
Packit |
6c4009 |
({ void *__l; \
|
|
Packit |
6c4009 |
register long __gp asm ("gp"); \
|
|
Packit |
6c4009 |
asm (";;\n\t" \
|
|
Packit |
6c4009 |
"mov loc0=gp\n\t" \
|
|
Packit |
6c4009 |
"addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t" \
|
|
Packit |
6c4009 |
"addl r17=@ltoff(@dtprel(" #x ")),gp\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"ld8 out0=[r16]\n\t" \
|
|
Packit |
6c4009 |
"ld8 out1=[r17]\n\t" \
|
|
Packit |
6c4009 |
"br.call.sptk.many b0=__tls_get_addr" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
"mov gp=loc0\n\t" \
|
|
Packit |
6c4009 |
"mov %0=r8\n\t" \
|
|
Packit |
6c4009 |
";;\n\t" \
|
|
Packit |
6c4009 |
: "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS); \
|
|
Packit |
6c4009 |
__l; })
|