Subversion Repositories HelenOS

Rev

Rev 2479 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2479 Rev 2581
Line 34... Line 34...
34
 *
34
 *
35
 */
35
 */
36
 
36
 
37
#include <thread.h>
37
#include <thread.h>
38
#include <malloc.h>
38
#include <malloc.h>
-
 
39
#include <align.h>
39
 
40
 
40
/*
41
/*
41
 * sparc64 uses thread-local storage data structures, variant II, as described
42
 * sparc64 uses thread-local storage data structures, variant II, as described
42
 * in:
43
 * in:
43
 *  Drepper U.: ELF Handling For Thread-Local Storage, 2005
44
 *  Drepper U.: ELF Handling For Thread-Local Storage, 2005
Line 54... Line 55...
54
 */
55
 */
55
tcb_t * __alloc_tls(void **data, size_t size)
56
tcb_t * __alloc_tls(void **data, size_t size)
56
{
57
{
57
    tcb_t *tcb;
58
    tcb_t *tcb;
58
   
59
   
-
 
60
    size = ALIGN_UP(size, &_tls_alignment);
59
    *data = malloc(sizeof(tcb_t) + size);
61
    *data = memalign(&_tls_alignment, sizeof(tcb_t) + size);
60
 
62
 
61
    tcb = (tcb_t *) (*data + size);
63
    tcb = (tcb_t *) (*data + size);
62
    tcb->self = tcb;
64
    tcb->self = tcb;
63
 
65
 
64
    return tcb;
66
    return tcb;
Line 71... Line 73...
71
 * @param tcb Pointer to TCB structure.
73
 * @param tcb Pointer to TCB structure.
72
 * @param size Size of thread local data.
74
 * @param size Size of thread local data.
73
 */
75
 */
74
void __free_tls_arch(tcb_t *tcb, size_t size)
76
void __free_tls_arch(tcb_t *tcb, size_t size)
75
{
77
{
-
 
78
    size = ALIGN_UP(size, &_tls_alignment);
76
    void *start = ((void *) tcb) - size;
79
    void *start = ((void *) tcb) - size;
77
    free(start);
80
    free(start);
78
}
81
}
79
 
82
 
80
/** @}
83
/** @}