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