Changeset dd92fe9


Ignore:
Timestamp:
Dec 15, 2020, 10:25:12 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
54eb1bb3
Parents:
ad2dced
git-author:
Peter A. Buhr <pabuhr@…> (12/15/20 21:51:36)
git-committer:
Peter A. Buhr <pabuhr@…> (12/15/20 22:25:12)
Message:

switch to page_size and map_prot

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/coroutine.cfa

    rad2dced rdd92fe9  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct 23 23:05:24 2020
    13 // Update Count     : 22
     12// Last Modified On : Tue Dec 15 12:06:04 2020
     13// Update Count     : 23
    1414//
    1515
     
    8888static const size_t MinStackSize = 1000;
    8989extern size_t __page_size;                              // architecture pagesize HACK, should go in proper runtime singleton
     90extern int __map_prot;
    9091
    9192void __stack_prepare( __stack_info_t * this, size_t create_size );
     
    206207                __cfaabi_dbg_debug_do(
    207208                        storage = (char*)(storage) - __page_size;
    208                         if ( mprotect( storage, __page_size, PROT_READ | PROT_WRITE ) == -1 ) {
     209                        if ( mprotect( storage, __page_size, __map_prot ) == -1 ) {
    209210                                abort( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) );
    210211                        }
  • libcfa/src/concurrency/kernel/startup.cfa

    rad2dced rdd92fe9  
    117117}
    118118
    119 size_t __page_size = 0;
     119extern size_t __page_size;
    120120
    121121//-----------------------------------------------------------------------------
     
    161161        /* paranoid */ verify( ! __preemption_enabled() );
    162162        __cfadbg_print_safe(runtime_core, "Kernel : Starting\n");
    163 
    164         __page_size = sysconf( _SC_PAGESIZE );
    165163
    166164        __cfa_dbg_global_clusters.list{ __get };
     
    681679        #if CFA_PROCESSOR_USE_MMAP
    682680                stacksize = ceiling( stacksize, __page_size ) + __page_size;
    683                 stack = mmap(0p, stacksize, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
     681                stack = mmap(0p, stacksize, __map_prot, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
    684682                if(stack == ((void*)-1)) {
    685683                        abort( "pthread stack creation : internal error, mmap failure, error(%d) %s.", errno, strerror( errno ) );
Note: See TracChangeset for help on using the changeset viewer.