tls-macros-i386.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #define TLS_LE(x) \
  2. ({ int *__l; \
  3. __asm__ ("movl %%gs:0,%0\n\t" \
  4. "subl $" #x "@tpoff,%0" \
  5. : "=r" (__l)); \
  6. __l; })
  7. /* The GOT-using sequences load %ebx themselves and must reserve it via
  8. a dummy "b" output, or gcc may keep a live value there across the asm. */
  9. #define TLS_IE(x) \
  10. ({ int *__l, __b; \
  11. __asm__ ("call 1f\n\t" \
  12. ".subsection 1\n" \
  13. "1:\tmovl (%%esp), %%ebx\n\t" \
  14. "ret\n\t" \
  15. ".previous\n\t" \
  16. "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
  17. "movl %%gs:0,%0\n\t" \
  18. "subl " #x "@gottpoff(%%ebx),%0" \
  19. : "=r" (__l), "=&b" (__b)); \
  20. __l; })
  21. #define TLS_LD(x) \
  22. ({ int *__l, __b, __c, __d; \
  23. __asm__ ("call 1f\n\t" \
  24. ".subsection 1\n" \
  25. "1:\tmovl (%%esp), %%ebx\n\t" \
  26. "ret\n\t" \
  27. ".previous\n\t" \
  28. "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
  29. "leal " #x "@tlsldm(%%ebx),%%eax\n\t" \
  30. "call ___tls_get_addr@plt\n\t" \
  31. "leal " #x "@dtpoff(%%eax), %%eax" \
  32. : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
  33. __l; })
  34. #define TLS_GD(x) \
  35. ({ int *__l, __b, __c, __d; \
  36. __asm__ ("call 1f\n\t" \
  37. ".subsection 1\n" \
  38. "1:\tmovl (%%esp), %%ebx\n\t" \
  39. "ret\n\t" \
  40. ".previous\n\t" \
  41. "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
  42. "leal " #x "@tlsgd(%%ebx),%%eax\n\t" \
  43. "call ___tls_get_addr@plt\n\t" \
  44. "nop" \
  45. : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
  46. __l; })