tls-macros-metag.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #define TLS_GD(x) \
  2. ({ void *__result; \
  3. extern void *__tls_get_addr (void *); \
  4. __asm__ ("MOV %0, A1LbP\n\t" \
  5. "ADD %0, %0, #(" #x "@TLSGD)" \
  6. : "=d" (__result)); \
  7. (int *)__tls_get_addr (__result); })
  8. #define TLS_LD(x) \
  9. ({ void *__result; \
  10. extern void *__tls_get_addr (void *); \
  11. __asm__ ("MOV %0, A1LbP\n\t" \
  12. "ADD %0, %0, #(" #x "@TLSLDM)" \
  13. : "=d" (__result)); \
  14. __result = __tls_get_addr (__result); \
  15. __asm__ ("ADDT %0,%0,#HI(" #x "@TLSLDO)\n\t" \
  16. "ADD %0,%0,#LO(" #x "@TLSLDO)" \
  17. : "+d" (__result)); \
  18. __result; })
  19. #define TLS_IE(x) \
  20. ({ void *__result; \
  21. unsigned long __rel; \
  22. extern void *__metag_load_tp (void); \
  23. __asm__ ("GETD %0,[A1LbP+#(" #x "@TLSIE)]" \
  24. : "=d" (__rel)); \
  25. __result = __metag_load_tp(); \
  26. __result + __rel; })
  27. #define TLS_LE(x) \
  28. ({ void *__result; \
  29. extern void *__metag_load_tp (void); \
  30. __result = __metag_load_tp(); \
  31. __asm__ ("ADDT %0,%0,#HI(" #x "@TLSLE)\n\t" \
  32. "ADD %0,%0,#LO(" #x "@TLSLE)" \
  33. : "+d" (__result)); \
  34. __result; })