Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/winecrt0/tls.c
12343 views
1
/*
2
* Copyright 2026 Jacek Caban for CodeWeavers
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17
*/
18
19
#ifdef __WINE_PE_BUILD
20
21
#include <stdarg.h>
22
#include "windef.h"
23
#include "winbase.h"
24
#include "wine/asm.h"
25
26
#ifdef __i386__
27
/* Offset of ThreadLocalStoragePointer in the TEB, the compiler uses %fs:_tls_array to access it. */
28
asm( ".globl " __ASM_NAME("_tls_array") "\n\t"
29
__ASM_NAME("_tls_array") "=44" );
30
#endif
31
32
int _tls_index = 0;
33
34
__attribute__((section(".tls"))) char _tls_start = 0;
35
__attribute__((section(".tls$ZZZ"))) char _tls_end = 0;
36
37
__attribute__((section(".CRT$XLA"))) void *__xl_a = 0;
38
__attribute__((section(".CRT$XLZ"))) void *__xl_z = 0;
39
40
const struct
41
{
42
void *StartAddressOfRawData;
43
void *EndAddressOfRawData;
44
void *AddressOfIndex;
45
void *AddressOfCallBacks;
46
ULONG SizeOfZeroFill;
47
ULONG Characteristics;
48
} _tls_used = {
49
&_tls_start,
50
&_tls_end,
51
&_tls_index,
52
&__xl_a + 1,
53
};
54
55
#endif
56
57