Hi,
Again, today, I had hope to simplify access thread local storage using data stored in the .tls segment. Actually, I'm doing all those stuff on base of the MS API methods like TlsAlloc/TlsReAlloc/TlsFree etc. So, I've managed the more complex part of dynamic TLS successfully - fine.
But this seems to me like an overkill for simple static data. I've to manage some static TLS. I try to put them within the .tls segment and the main process thread correctly accesses them - but - all worker threads also access those variables. I conclude, there is no automatism a thread "knows" the section offset of its own variable block. Ok, my second guess is using some segment register doing that. From internet I had some indications fs (for x86) as well as gs (for x64) could hold that info - but again, not automatically. Perhaps, I’ve to load them with the correct offsets? (Honestly, I never ever expected something different - lol)
Does anybody have an idea how it works? For the moment I’m interested in x86 solutions, only.
Many thanks,
Mene