Subversion Repositories HelenOS

Rev

Rev 2927 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2927 Rev 3552
Line 34... Line 34...
34
  * @ingroup libcia32
34
  * @ingroup libcia32
35
 */
35
 */
36
 
36
 
37
#include <tls.h>
37
#include <tls.h>
38
#include <sys/types.h>
38
#include <sys/types.h>
-
 
39
#include <align.h>
39
 
40
 
40
tcb_t * __alloc_tls(void **data, size_t size)
41
tcb_t * __alloc_tls(void **data, size_t size)
41
{
42
{
42
    return tls_alloc_variant_2(data, size);
43
    return tls_alloc_variant_2(data, size);
43
}
44
}
Line 45... Line 46...
45
void __free_tls_arch(tcb_t *tcb, size_t size)
46
void __free_tls_arch(tcb_t *tcb, size_t size)
46
{
47
{
47
    tls_free_variant_2(tcb, size);
48
    tls_free_variant_2(tcb, size);
48
}
49
}
49
 
50
 
-
 
51
//#ifdef __SHARED__
-
 
52
 
-
 
53
typedef struct {
-
 
54
    unsigned long int ti_module;
-
 
55
    unsigned long int ti_offset;
-
 
56
} tls_index;
-
 
57
 
-
 
58
void __attribute__ ((__regparm__ (1)))
-
 
59
    *___tls_get_addr(tls_index *ti);
-
 
60
 
-
 
61
void __attribute__ ((__regparm__ (1)))
-
 
62
    *___tls_get_addr(tls_index *ti)
-
 
63
{
-
 
64
    size_t tls_size;
-
 
65
    uint8_t *tls;
-
 
66
 
-
 
67
    /* Calculate size of TLS block */
-
 
68
    tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment);
-
 
69
 
-
 
70
    /* The TLS block is just before TCB */
-
 
71
    tls = (uint8_t *)__tcb_get() - tls_size;
-
 
72
 
-
 
73
    return tls + ti->ti_offset;
-
 
74
}
-
 
75
 
-
 
76
//#endif
-
 
77
 
50
/** @}
78
/** @}
51
 */
79
 */