source: mainline/uspace/lib/c/arch/amd64/src/tls.c@ 8624d1f

Last change on this file since 8624d1f was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 1010 bytes
Line 
1/*
2 * SPDX-FileCopyrightText: 2006 Ondrej Palkovsky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libcamd64 amd64
8 * @ingroup lc
9 * @{
10 */
11/** @file
12 * @ingroup libcia32
13 */
14
15#include <tls.h>
16#include <stddef.h>
17
18#ifdef CONFIG_RTLD
19#include <rtld/rtld.h>
20#endif
21
22tcb_t *tls_alloc_arch(size_t size, size_t align)
23{
24 return tls_alloc_variant_2(size, align);
25}
26
27void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
28{
29 tls_free_variant_2(tcb, size, align);
30}
31
32/*
33 * Rtld TLS support
34 */
35
36typedef struct {
37 unsigned long int ti_module;
38 unsigned long int ti_offset;
39} tls_index;
40
41void __attribute__((__regparm__(1)))
42 *__tls_get_addr(tls_index *ti);
43
44void __attribute__((__regparm__(1)))
45 *__tls_get_addr(tls_index *ti)
46{
47 uint8_t *tls;
48
49#ifdef CONFIG_RTLD
50 if (runtime_env != NULL) {
51 return rtld_tls_get_addr(runtime_env, __tcb_get(),
52 ti->ti_module, ti->ti_offset);
53 }
54#endif
55 /* Get address of static TLS block */
56 tls = tls_get();
57 return tls + ti->ti_offset;
58}
59
60/** @}
61 */
Note: See TracBrowser for help on using the repository browser.