Changeset c739102 in mainline for uspace/lib/c/generic/fibril.c
- Timestamp:
- 2012-11-21T23:26:22Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2c80a
- Parents:
- bebf97d (diff), 1f7753a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril.c
rbebf97d rc739102 37 37 #include <fibril.h> 38 38 #include <thread.h> 39 #include <stack.h> 39 40 #include <tls.h> 40 41 #include <malloc.h> 42 #include <abi/mm/as.h> 43 #include <as.h> 41 44 #include <unistd.h> 42 45 #include <stdio.h> … … 46 49 #include <assert.h> 47 50 #include <async.h> 48 49 #ifndef FIBRIL_INITIAL_STACK_PAGES_NO50 #define FIBRIL_INITIAL_STACK_PAGES_NO 151 #endif52 51 53 52 /** … … 195 194 * stack member filled. 196 195 */ 197 free(stack);196 as_area_destroy(stack); 198 197 } 199 198 fibril_teardown(srcf->clean_after_me); … … 269 268 return 0; 270 269 271 fibril->stack = 272 (char *) malloc(FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize()); 273 if (!fibril->stack) { 270 size_t stack_size = stack_size_get(); 271 fibril->stack = as_area_create((void *) -1, stack_size, 272 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD | 273 AS_AREA_LATE_RESERVE); 274 if (fibril->stack == (void *) -1) { 274 275 fibril_teardown(fibril); 275 276 return 0; … … 281 282 context_save(&fibril->ctx); 282 283 context_set(&fibril->ctx, FADDR(fibril_main), fibril->stack, 283 FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), fibril->tcb);284 stack_size, fibril->tcb); 284 285 285 286 return (fid_t) fibril; … … 298 299 fibril_t *fibril = (fibril_t *) fid; 299 300 300 free(fibril->stack);301 as_area_destroy(fibril->stack); 301 302 fibril_teardown(fibril); 302 303 }
Note:
See TracChangeset
for help on using the changeset viewer.