Changeset 74359c6 in mainline for uspace/libc/generic/thread.c
- Timestamp:
- 2006-12-30T13:36:13Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 33c0c649
- Parents:
- 66eb2c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/generic/thread.c
r66eb2c8 r74359c6 56 56 extern char _tbss_end; 57 57 58 /** Create T hread Local storage area, return pointer to TCB(ThreadControlBlock)58 /** Create TLS (Thread Local Storage) data structures. 59 59 * 60 * !! The code requires, that sections .tdata and .tbss are adjacent. 61 * It may be changed in the future. 60 * The code requires, that sections .tdata and .tbss are adjacent. It may be 61 * changed in the future. 62 * 63 * @return Pointer to TCB. 62 64 */ 63 tcb_t * 65 tcb_t *__make_tls(void) 64 66 { 65 67 void *data; … … 69 71 tcb = __alloc_tls(&data, tls_size); 70 72 73 /* 74 * Copy thread local data from the initialization image. 75 */ 71 76 memcpy(data, &_tdata_start, &_tdata_end - &_tdata_start); 72 memset(data + (&_tbss_start-&_tdata_start), 0, &_tbss_end-&_tbss_start); 77 /* 78 * Zero out the thread local uninitialized data. 79 */ 80 memset(data + (&_tbss_start - &_tdata_start), 0, &_tbss_end - 81 &_tbss_start); 82 73 83 return tcb; 74 84 } … … 88 98 * 89 99 * @param uarg Pointer to userspace argument structure. 90 *91 * TODO: Thread stack pages memory leak92 100 */ 93 101 void __thread_main(uspace_arg_t *uarg) … … 125 133 uspace_arg_t *uarg; 126 134 127 stack = (char *) malloc(getpagesize() *THREAD_INITIAL_STACK_PAGES_NO);135 stack = (char *) malloc(getpagesize() * THREAD_INITIAL_STACK_PAGES_NO); 128 136 if (!stack) 129 137 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.