Changeset 1107050 in mainline


Ignore:
Timestamp:
2012-11-06T22:56:02Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9a9c805
Parents:
692bd3f2
Message:

Allocate fibril stacks as guarded and non-pre-reserved address space areas.

File:
1 edited

Legend:

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

    r692bd3f2 r1107050  
    3939#include <tls.h>
    4040#include <malloc.h>
     41#include <abi/mm/as.h>
     42#include <as.h>
    4143#include <unistd.h>
    4244#include <stdio.h>
     
    195197                                         * stack member filled.
    196198                                         */
    197                                         free(stack);
     199                                        as_area_destroy(stack);
    198200                                }
    199201                                fibril_teardown(srcf->clean_after_me);
     
    269271                return 0;
    270272       
    271         fibril->stack =
    272             (char *) malloc(FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize());
    273         if (!fibril->stack) {
     273        fibril->stack = as_area_create((void *) -1,
     274            FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(),
     275            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
     276            AS_AREA_NORESERVE);
     277        if (fibril->stack == (void *) -1) {
    274278                fibril_teardown(fibril);
    275279                return 0;
     
    298302        fibril_t *fibril = (fibril_t *) fid;
    299303       
    300         free(fibril->stack);
     304        as_area_destroy(fibril->stack);
    301305        fibril_teardown(fibril);
    302306}
Note: See TracChangeset for help on using the changeset viewer.