Rev 2479 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2479 | Rev 2586 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | * @ingroup libcmips32eb |
33 | * @ingroup libcmips32eb |
34 | */ |
34 | */ |
35 | 35 | ||
36 | #include <thread.h> |
36 | #include <tls.h> |
37 | #include <malloc.h> |
37 | #include <sys/types.h> |
38 | 38 | ||
39 | /** Allocate TLS & TCB for initial module threads |
- | |
40 | * |
- | |
41 | * @param data (out) Start of TLS section |
- | |
42 | * @param size Size of tdata+tbss section |
- | |
43 | * @return pointer to tcb_t structure |
- | |
44 | */ |
- | |
45 | tcb_t * __alloc_tls(void **data, size_t size) |
39 | tcb_t * __alloc_tls(void **data, size_t size) |
46 | { |
40 | { |
47 | tcb_t *result; |
- | |
48 | - | ||
49 | result = malloc(sizeof(tcb_t) + size); |
41 | return tls_alloc_variant_1(data, size); |
50 | *data = ((void *)result) + sizeof(tcb_t); |
- | |
51 | return result; |
- | |
52 | } |
42 | } |
53 | 43 | ||
54 | void __free_tls_arch(tcb_t *tcb, size_t size) |
44 | void __free_tls_arch(tcb_t *tcb, size_t size) |
55 | { |
45 | { |
56 | free(tcb); |
46 | tls_free_variant_1(tcb, size); |
57 | } |
47 | } |
58 | 48 | ||
59 | /** @} |
49 | /** @} |
60 | */ |
50 | */ |