tls.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Definition for thread-local data handling. Generic version.
  2. Copyright (C) 2002 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. /* By default no TLS support is available. This is signaled by the
  16. absence of the symbol USE_TLS. */
  17. #undef USE_TLS
  18. /* An architecture-specific version of this file has to defined a
  19. number of symbols:
  20. TLS_TCB_AT_TP or TLS_DTV_AT_TP
  21. The presence of one of these symbols signals which variant of
  22. the TLS ABI is used. There are in the moment two variants
  23. available:
  24. * the thread pointer points to a thread control block
  25. * the thread pointer points to the dynamic thread vector
  26. TLS_TCB_SIZE
  27. This is the size of the thread control block structure. How
  28. this is actually defined depends on the ABI. The thread control
  29. block could be internal descriptor of the thread library or
  30. just a data structure which allows finding the DTV.
  31. TLS_INIT_TCB_SIZE
  32. Similarly, but this value is only used at startup and in the
  33. dynamic linker itself. There are no threads in use at that time.
  34. TLS_TCB_ALIGN
  35. Alignment requirements for the TCB structure.
  36. TLS_INIT_TCB_ALIGN
  37. Similarly, but for the structure used at startup time.
  38. INSTALL_DTV(tcb, init_dtv)
  39. This macro must install the given initial DTV into the thread control
  40. block TCB. The normal runtime functionality must then be able to
  41. use the value.
  42. TLS_INIT_TP(tcb, firstcall)
  43. This macro must initialize the thread pointer to enable normal TLS
  44. operation. The first parameter is a pointer to the thread control
  45. block. The second parameter specifies whether this is the first
  46. call for the TCB. ld.so calls this macro more than once.
  47. THREAD_DTV()
  48. This macro returns the address of the DTV of the current thread.
  49. This normally is done using the the thread register which points
  50. to the dtv or the TCB (from which the DTV can found).
  51. */