|
Packit |
6c4009 |
#define TLS_LE(x) \
|
|
Packit |
6c4009 |
({ int *__result; \
|
|
Packit |
6c4009 |
asm ("addi %0, r23, %%tls_le(" #x ")" \
|
|
Packit |
6c4009 |
: "=r" (__result)); \
|
|
Packit |
6c4009 |
__result; })
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define TLS_IE(x) \
|
|
Packit |
6c4009 |
({ int *__result; \
|
|
Packit |
6c4009 |
int __tmp; \
|
|
Packit |
6c4009 |
asm ("nextpc %0 ; " \
|
|
Packit |
6c4009 |
"1: movhi %1, %%hiadj(_gp_got - 1b) ; " \
|
|
Packit |
6c4009 |
"addi %1, %1, %%lo(_gp_got - 1b) ; " \
|
|
Packit |
6c4009 |
"add %0, %0, %1 ; " \
|
|
Packit |
6c4009 |
"ldw %1, %%tls_ie(" #x ")(%0) ; " \
|
|
Packit |
6c4009 |
"add %1, r23, %1" \
|
|
Packit |
6c4009 |
: "=&r" (__tmp), "=&r" (__result)); \
|
|
Packit |
6c4009 |
__result; })
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define TLS_LD(x) \
|
|
Packit |
6c4009 |
({ char *__result; \
|
|
Packit |
6c4009 |
char *__result2; \
|
|
Packit |
6c4009 |
int *__result3; \
|
|
Packit |
6c4009 |
int __tmp; \
|
|
Packit |
6c4009 |
extern void *__tls_get_addr (void *); \
|
|
Packit |
6c4009 |
asm ("nextpc %0 ; " \
|
|
Packit |
6c4009 |
"1: movhi %1, %%hiadj(_gp_got - 1b) ; " \
|
|
Packit |
6c4009 |
"addi %1, %1, %%lo(_gp_got - 1b) ; " \
|
|
Packit |
6c4009 |
"add %0, %0, %1 ; " \
|
|
Packit |
6c4009 |
"addi %0, %0, %%tls_ldm(" #x ")" \
|
|
Packit |
6c4009 |
: "=r" (__result), "=r" (__tmp)); \
|
|
Packit |
6c4009 |
__result2 = (char *)__tls_get_addr (__result); \
|
|
Packit |
6c4009 |
asm ("addi %0, %1, %%tls_ldo(" #x ")" \
|
|
Packit |
6c4009 |
: "=r" (__result3) : "r" (__result2)); \
|
|
Packit |
6c4009 |
__result3; })
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define TLS_GD(x) \
|
|
Packit |
6c4009 |
({ int *__result; \
|
|
Packit |
6c4009 |
int __tmp; \
|
|
Packit |
6c4009 |
extern void *__tls_get_addr (void *); \
|
|
Packit |
6c4009 |
asm ("nextpc %0 ; " \
|
|
Packit |
6c4009 |
"1: movhi %1, %%hiadj(_gp_got - 1b) ; " \
|
|
Packit |
6c4009 |
"addi %1, %1, %%lo(_gp_got - 1b) ; " \
|
|
Packit |
6c4009 |
"add %0, %0, %1 ; " \
|
|
Packit |
6c4009 |
"addi %0, %0, %%tls_gd(" #x ")" \
|
|
Packit |
6c4009 |
: "=r" (__result), "=r" (__tmp)); \
|
|
Packit |
6c4009 |
(int *)__tls_get_addr (__result); })
|