Changeset c739102 in mainline for uspace/lib/c/generic/fibril.c


Ignore:
Timestamp:
2012-11-21T23:26:22Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
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.
Message:

Mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/fibril.c

    rbebf97d rc739102  
    3737#include <fibril.h>
    3838#include <thread.h>
     39#include <stack.h>
    3940#include <tls.h>
    4041#include <malloc.h>
     42#include <abi/mm/as.h>
     43#include <as.h>
    4144#include <unistd.h>
    4245#include <stdio.h>
     
    4649#include <assert.h>
    4750#include <async.h>
    48 
    49 #ifndef FIBRIL_INITIAL_STACK_PAGES_NO
    50         #define FIBRIL_INITIAL_STACK_PAGES_NO  1
    51 #endif
    5251
    5352/**
     
    195194                                         * stack member filled.
    196195                                         */
    197                                         free(stack);
     196                                        as_area_destroy(stack);
    198197                                }
    199198                                fibril_teardown(srcf->clean_after_me);
     
    269268                return 0;
    270269       
    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) {
    274275                fibril_teardown(fibril);
    275276                return 0;
     
    281282        context_save(&fibril->ctx);
    282283        context_set(&fibril->ctx, FADDR(fibril_main), fibril->stack,
    283             FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), fibril->tcb);
     284            stack_size, fibril->tcb);
    284285
    285286        return (fid_t) fibril;
     
    298299        fibril_t *fibril = (fibril_t *) fid;
    299300       
    300         free(fibril->stack);
     301        as_area_destroy(fibril->stack);
    301302        fibril_teardown(fibril);
    302303}
Note: See TracChangeset for help on using the changeset viewer.