tls-macros-powerpc64.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #define __TLS_CALL_CLOBBERS \
  2. "0", "4", "5", "6", "7", "8", "9", "10", "11", "12", \
  3. "lr", "ctr", "cr0", "cr1", "cr5", "cr6", "cr7"
  4. /* PowerPC64 Local Exec TLS access. */
  5. #define TLS_LE(x) \
  6. ({ int * __result; \
  7. asm ("addis %0,13," #x "@tprel@ha\n\t" \
  8. "addi %0,%0," #x "@tprel@l" \
  9. : "=b" (__result) ); \
  10. __result; \
  11. })
  12. /* PowerPC64 Initial Exec TLS access. */
  13. #define TLS_IE(x) \
  14. ({ int * __result; \
  15. asm ("ld %0," #x "@got@tprel(2)\n\t" \
  16. "add %0,%0," #x "@tls" \
  17. : "=r" (__result) ); \
  18. __result; \
  19. })
  20. /* PowerPC64 Local Dynamic TLS access. */
  21. #define TLS_LD(x) \
  22. ({ int * __result; \
  23. asm ("addi 3,2," #x "@got@tlsld\n\t" \
  24. "bl __tls_get_addr\n\t" \
  25. "nop \n\t" \
  26. "addis %0,3," #x "@dtprel@ha\n\t" \
  27. "addi %0,%0," #x "@dtprel@l" \
  28. : "=b" (__result) : \
  29. : "3", __TLS_CALL_CLOBBERS); \
  30. __result; \
  31. })
  32. /* PowerPC64 General Dynamic TLS access. */
  33. #define TLS_GD(x) \
  34. ({ register int *__result __asm__ ("r3"); \
  35. asm ("addi 3,2," #x "@got@tlsgd\n\t" \
  36. "bl __tls_get_addr\n\t" \
  37. "nop " \
  38. : "=r" (__result) : \
  39. : __TLS_CALL_CLOBBERS); \
  40. __result; \
  41. })