Syntax
.tls$ expression
Note Support for the .tls$ directive is a feature that may not be available on all versions of the Alpha assembler.
Description
The .tls$ directive instructs the assembler to add subsequent code to the .tls$ section, named with the expression provided. Symbols defined in the .tls$ section (thread local storage) are local to the currently executing thread and are equivalent to variables defined in the C language as __declspec(thread).
To access a symbol in thread local storage, it is necessary to obtain access to the Thread Environment Block (TEB). A pointer to the TLS array is located at offset 0x2c from the TEB. The tls index (_tls_index) is multiplied by 4 and added to the address of the TLS array to obtain the address of the thread’s TLS data area. Refer to the example that illustrates how to obtain this value.