On Windows, the fs
(x86), gs
(x64) or x18
(aarch64) register is used to address the Thread Information Block (TIB). With the MSVC C++ compiler these can be accessed via intrinsics such as __readgsdword
which will read a u32
for the given offset from the gs
base.
On other platforms these registers can also be used for platform-specific purposes (I think glibc uses fs
for TLS).
Currently there is no stable way to access these registers. Could some way to access platform registers be added to core::arch
? I realize that if/when asm!
is stabilized there would be another way to access these registers but then again this could be said about most things in arch
.