Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1 KiB

  1. #ifdef _MSC_VER
  2. /* tlssup.c - Thread Local Storage runtime support module */
  3. #include <nt.h>
  4. /* Thread Local Storage index for this .EXE or .DLL */
  5. ULONG _tls_index = 0;
  6. /* Special symbols to mark start and end of Thread Local Storage area.
  7. * By convention, we initialize each with a pointer to it's own address.
  8. */
  9. #pragma data_seg(".tls")
  10. PVOID _tls_start = &_tls_start;
  11. #pragma data_seg(".tls$ZZZ")
  12. PVOID _tls_end = &_tls_end;
  13. /* Start and end sections for Threadl Local Storage CallBack Array.
  14. * Actual array is constructed using .CRT$XLA, .CRT$XLC, .CRT$XLL,
  15. * .CRT$XLU, .CRT$XLZ similar to the way global
  16. * static initializers are done for C++.
  17. */
  18. #pragma data_seg(".CRT$XLA")
  19. PIMAGE_TLS_CALLBACK __xl_a = 0;
  20. #pragma data_seg(".CRT$XLZ")
  21. PIMAGE_TLS_CALLBACK __xl_z = 0;
  22. #pragma data_seg(".rdata$T")
  23. IMAGE_TLS_DIRECTORY _tls_used =
  24. {
  25. (ULONG) &_tls_start, // start of tls data
  26. (ULONG) &_tls_end, // end of tls data
  27. &_tls_index, // address of tls_index
  28. &__xl_a, // pointer to call back array
  29. (ULONG) 0, // size of tls zero fill
  30. (ULONG) 0 // characteristics
  31. };
  32. #endif /* _MSC_VER */