tls.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /* By default no TLS support is available. This is signaled by the
  17. absence of the symbol USE_TLS. */
  18. #undef USE_TLS
  19. /* An architecture-specific version of this file has to defined a
  20. number of symbols:
  21. TLS_TCB_AT_TP or TLS_DTV_AT_TP
  22. The presence of one of these symbols signals which variant of
  23. the TLS ABI is used. There are in the moment two variants
  24. available:
  25. * the thread pointer points to a thread control block
  26. * the thread pointer points to the dynamic thread vector
  27. TLS_TCB_SIZE
  28. This is the size of the thread control block structure. How
  29. this is actually defined depends on the ABI. The thread control
  30. block could be internal descriptor of the thread library or
  31. just a data structure which allows finding the DTV.
  32. TLS_INIT_TCB_SIZE
  33. Similarly, but this value is only used at startup and in the
  34. dynamic linker itself. There are no threads in use at that time.
  35. TLS_TCB_ALIGN
  36. Alignment requirements for the TCB structure.
  37. TLS_INIT_TCB_ALIGN
  38. Similarly, but for the structure used at startup time.
  39. INSTALL_DTV(tcb, init_dtv)
  40. This macro must install the given initial DTV into the thread control
  41. block TCB. The normal runtime functionality must then be able to
  42. use the value.
  43. TLS_INIT_TP(tcb, firstcall)
  44. This macro must initialize the thread pointer to enable normal TLS
  45. operation. The first parameter is a pointer to the thread control
  46. block. The second parameter specifies whether this is the first
  47. call for the TCB. ld.so calls this macro more than once.
  48. THREAD_DTV()
  49. This macro returns the address of the DTV of the current thread.
  50. This normally is done using the the thread register which points
  51. to the dtv or the TCB (from which the DTV can found).
  52. */