2 * Copyright 2014, Paweł Dziepak, pdziepak@quarnos.org.
3 * Distributed under the terms of the MIT License.
9 #include "runtime_loader_private.h"
15 class TLSBlockTemplate
{
17 TLSBlockTemplate() { }
18 inline TLSBlockTemplate(void* address
, size_t fileSize
,
21 void SetGeneration(unsigned generation
)
22 { fGeneration
= generation
; }
23 unsigned Generation() const { return fGeneration
; }
25 void SetBaseAddress(addr_t baseAddress
);
27 TLSBlock
CreateBlock();
37 class TLSBlockTemplates
{
39 static TLSBlockTemplates
& Get();
41 unsigned Register(const TLSBlockTemplate
& block
);
42 void Unregister(unsigned dso
);
44 void SetBaseAddress(unsigned dso
, addr_t baseAddress
);
46 unsigned GetGeneration(unsigned dso
) const;
48 TLSBlock
CreateBlock(unsigned dso
);
51 inline TLSBlockTemplates();
53 static TLSBlockTemplates
* fInstance
;
57 utility::vector
<TLSBlockTemplate
> fTemplates
;
58 utility::vector
<unsigned> fFreeDSOs
;
62 TLSBlockTemplate::TLSBlockTemplate(void* address
, size_t fileSize
,
67 fMemorySize(memorySize
)
72 void* get_tls_address(unsigned dso
, addr_t offset
);
73 void destroy_thread_tls();