Ignore:
Timestamp:
Feb 17, 2022, 12:56:46 PM (3 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
8ee163e2
Parents:
3263e2a4
Message:

removed old memory allocator and replaced it with the concurrent allocator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/startup.cfa

    r3263e2a4 r5614a191  
    122122extern "C" {
    123123        struct { __dllist_t(cluster) list; __spinlock_t lock; } __cfa_dbg_global_clusters;
    124 }
    125 
    126 extern size_t __page_size;
    127 extern int __map_prot;
     124        extern size_t __cfa_page_size;
     125        extern int __map_prot;
     126}
    128127
    129128//-----------------------------------------------------------------------------
     
    574573}
    575574
    576 extern size_t __page_size;
    577575void ^?{}(processor & this) with( this ){
    578576        /* paranoid */ verify( !__atomic_load_n(&do_terminate, __ATOMIC_ACQUIRE) );
     
    740738        void * stack;
    741739        #if CFA_PROCESSOR_USE_MMAP
    742                 stacksize = ceiling( stacksize, __page_size ) + __page_size;
     740                stacksize = ceiling( stacksize, __cfa_page_size ) + __cfa_page_size;
    743741                stack = mmap(0p, stacksize, __map_prot, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
    744742                if(stack == ((void*)-1)) {
    745743                        abort( "pthread stack creation : internal error, mmap failure, error(%d) %s.", errno, strerror( errno ) );
    746744                }
    747                 if ( mprotect( stack, __page_size, PROT_NONE ) == -1 ) {
     745                if ( mprotect( stack, __cfa_page_size, PROT_NONE ) == -1 ) {
    748746                        abort( "pthread stack creation : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
    749747                } // if
    750748        #else
    751749                __cfaabi_dbg_debug_do(
    752                         stack = memalign( __page_size, stacksize + __page_size );
     750                        stack = memalign( __cfa_page_size, stacksize + __cfa_page_size );
    753751                        // pthread has no mechanism to create the guard page in user supplied stack.
    754                         if ( mprotect( stack, __page_size, PROT_NONE ) == -1 ) {
     752                        if ( mprotect( stack, __cfa_page_size, PROT_NONE ) == -1 ) {
    755753                                abort( "mprotect : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
    756754                        } // if
     
    779777                check( pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" );
    780778                assert( stacksize >= PTHREAD_STACK_MIN );
    781                 stacksize += __page_size;
     779                stacksize += __cfa_page_size;
    782780
    783781                if(munmap(stack, stacksize) == -1) {
     
    787785                __cfaabi_dbg_debug_do(
    788786                        // pthread has no mechanism to create the guard page in user supplied stack.
    789                         if ( mprotect( stack, __page_size, __map_prot ) == -1 ) {
     787                        if ( mprotect( stack, __cfa_page_size, __map_prot ) == -1 ) {
    790788                                abort( "mprotect : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
    791789                        } // if
Note: See TracChangeset for help on using the changeset viewer.