FX Coudert wrote:

The support for TLS (Thread Local Storage) would probably come from the compiler itself. Windows has TLS (see for example http:// dotnet.di.unipi.it/Content/sscli/docs/doxygen/pal/localstorage_8c- source.html and http://www.ddj.com/dept/cpp/184403874, or the MSDN documentation at http://msdn.microsoft.com/library/default.asp?url=/ library/en-us/dllproc/base/tlsalloc.asp), so you'd "only" need to teach GCC how to call that.

fs:[0x14] is a per-thread 32-bit word available for applications,
so you can store a pointer to your own TLS array there. fs:[0x2c] points to a Windows-specific TLS array, so you can
make use of it, too, but you must conform to the limitations of
the WinAPI constraints related with TLS management. IMO the
best would be the offset 0x14 + a custom design of TLSes (BTW,
it must be extremely fast! Many applications get their TLS values
very often).

Now, for an idea of how much work it represents... perhaps someone here can tell us?

I don't know much about GCC internals, but I use my own
implementation based on inline assembly and the implementation
took, hm, 20 minutes?
Best regards
   Piotr Wyderski

Reply via email to