Ignore:
File:
1 edited

Legend:

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

    r1a7203d r6b33e89  
    6969//-----------------------------------------------------------------------------
    7070// Start and stop routine for the kernel, declared first to make sure they run first
    71 static void __kernel_startup (void) __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
    72 static void __kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
     71static void __kernel_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
     72static void __kernel_shutdown(void) __attribute__(( destructor( STARTUP_PRIORITY_KERNEL ) ));
    7373
    7474//-----------------------------------------------------------------------------
     
    7878static void * __invoke_processor(void * arg);
    7979static void __kernel_first_resume( processor * this );
    80 static void __kernel_last_resume ( processor * this );
     80static void __kernel_last_resume( processor * this );
    8181static void init(processor & this, const char name[], cluster & _cltr, thread$ * initT);
    8282static void deinit(processor & this);
     
    9999extern void __kernel_alarm_shutdown(void);
    100100extern void __cfa_io_start( processor * );
    101 extern void __cfa_io_stop ( processor * );
     101extern void __cfa_io_stop( processor * );
    102102
    103103//-----------------------------------------------------------------------------
     
    110110//-----------------------------------------------------------------------------
    111111// Kernel storage
    112 KERNEL_STORAGE(cluster,              mainCluster);
    113 KERNEL_STORAGE(processor,            mainProcessor);
    114 KERNEL_STORAGE(thread$,              mainThread);
    115 KERNEL_STORAGE(__stack_t,            mainThreadCtx);
     112KERNEL_STORAGE(cluster, mainCluster);
     113KERNEL_STORAGE(processor, mainProcessor);
     114KERNEL_STORAGE(thread$, mainThread);
     115KERNEL_STORAGE(__stack_t, mainThreadCtx);
    116116#if !defined(__CFA_NO_STATISTICS__)
    117117KERNEL_STORAGE(__stats_t, mainProcStats);
    118118#endif
    119119
    120 cluster              * mainCluster libcfa_public;
    121 processor            * mainProcessor;
    122 thread$              * mainThread;
     120cluster * mainCluster libcfa_public;
     121processor * mainProcessor;
     122thread$ * mainThread;
    123123
    124124extern "C" {
     
    150150// Struct to steal stack
    151151struct current_stack_info_t {
    152         __stack_t * storage;  // pointer to stack object
    153         void * base;          // base of stack
    154         void * limit;         // stack grows towards stack limit
    155         void * context;       // address of cfa_context_t
     152        __stack_t * storage;                                                            // pointer to stack object
     153        void * base;                                                                            // base of stack
     154        void * limit;                                                                           // stack grows towards stack limit
     155        void * context;                                                                         // address of cfa_context_t
    156156};
    157157
     
    234234        //initialize the global state variables
    235235        __cfaabi_tls.this_processor = mainProcessor;
    236         __cfaabi_tls.this_thread    = mainThread;
     236        __cfaabi_tls.this_thread = mainThread;
    237237
    238238        #if !defined( __CFA_NO_STATISTICS__ )
     
    355355        processor * proc = (processor *) arg;
    356356        __cfaabi_tls.this_processor = proc;
    357         __cfaabi_tls.this_thread    = 0p;
     357        __cfaabi_tls.this_thread = 0p;
    358358        __cfaabi_tls.preemption_state.[enabled, disable_count] = [false, 1];
    359359        proc->local_data = &__cfaabi_tls;
     
    477477        stack.storage = info->storage;
    478478        with(*stack.storage) {
    479                 limit     = info->limit;
    480                 base      = info->base;
     479                limit = info->limit;
     480                base = info->base;
    481481        }
    482482        __attribute__((may_alias)) intptr_t * istorage = (intptr_t*) &stack.storage;
     
    485485        state = Start;
    486486        starter = 0p;
    487         last = 0p;
     487        this.last = 0p;
    488488        cancellation = 0p;
    489     ehm_state.ehm_buffer{};
    490     ehm_state.buffer_lock{};
    491     ehm_state.ehm_enabled = false;
     489        ehm_state.ehm_buffer{};
     490        ehm_state.buffer_lock{};
     491        ehm_state.ehm_enabled = false;
    492492}
    493493
     
    502502        self_mon_p = &self_mon;
    503503        rdy_link.next = 0p;
    504         rdy_link.ts   = MAX;
     504        rdy_link.ts = MAX;
    505505        user_link.next = 0p;
    506506        user_link.prev = 0p;
     
    509509        preferred = ready_queue_new_preferred();
    510510        last_proc = 0p;
    511         PRNG_SET_SEED( random_state,  __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl() );
     511        PRNG_SET_SEED( random_state, __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl() );
    512512        #if defined( __CFA_WITH_VERIFY__ )
    513513                executing = 0p;
     
    531531        this.name = name;
    532532        this.cltr = &_cltr;
    533     __atomic_add_fetch( &_cltr.procs.constructed, 1u, __ATOMIC_RELAXED );
     533        __atomic_add_fetch( &_cltr.procs.constructed, 1u, __ATOMIC_RELAXED );
    534534        this.rdq.its = 0;
    535535        this.rdq.itr = 0;
    536         this.rdq.id  = 0;
     536        this.rdq.id = 0;
    537537        this.rdq.target = MAX;
    538538        this.rdq.last = MAX;
     
    545545        this.io.ctx = 0p;
    546546        this.io.pending = false;
    547         this.io.dirty   = false;
     547        this.io.dirty = false;
    548548
    549549        this.init.thrd = initT;
     
    599599        __cfadbg_print_safe(runtime_core, "Kernel : core %p signaling termination\n", &this);
    600600
    601     __atomic_sub_fetch( &this.cltr->procs.constructed, 1u, __ATOMIC_RELAXED );
     601        __atomic_sub_fetch( &this.cltr->procs.constructed, 1u, __ATOMIC_RELAXED );
    602602
    603603        __atomic_store_n(&do_terminate, true, __ATOMIC_RELAXED);
     
    619619// Cluster
    620620static void ?{}(__cluster_proc_list & this) {
    621         this.fdw   = 0p;
    622         this.idle  = 0;
    623     this.constructed = 0;
     621        this.fdw = 0p;
     622        this.idle = 0;
     623        this.constructed = 0;
    624624        this.total = 0;
    625625}
     
    706706//-----------------------------------------------------------------------------
    707707// Global Queues
    708 static void doregister( cluster     & cltr ) {
    709         lock      ( __cfa_dbg_global_clusters.lock __cfaabi_dbg_ctx2);
     708static void doregister( cluster & cltr ) {
     709        lock( __cfa_dbg_global_clusters.lock __cfaabi_dbg_ctx2);
    710710        push_front( __cfa_dbg_global_clusters.list, cltr );
    711         unlock    ( __cfa_dbg_global_clusters.lock );
    712 }
    713 
    714 static void unregister( cluster     & cltr ) {
    715         lock  ( __cfa_dbg_global_clusters.lock __cfaabi_dbg_ctx2);
     711        unlock( __cfa_dbg_global_clusters.lock );
     712}
     713
     714static void unregister( cluster & cltr ) {
     715        lock( __cfa_dbg_global_clusters.lock __cfaabi_dbg_ctx2);
    716716        remove( __cfa_dbg_global_clusters.list, cltr );
    717717        unlock( __cfa_dbg_global_clusters.lock );
     
    719719
    720720void doregister( cluster * cltr, thread$ & thrd ) {
    721         lock      (cltr->thread_list_lock __cfaabi_dbg_ctx2);
     721        lock(cltr->thread_list_lock __cfaabi_dbg_ctx2);
    722722        cltr->nthreads += 1;
    723723        insert_first(cltr->threads, thrd);
    724         unlock    (cltr->thread_list_lock);
     724        unlock(cltr->thread_list_lock);
    725725}
    726726
    727727void unregister( cluster * cltr, thread$ & thrd ) {
    728         lock  (cltr->thread_list_lock __cfaabi_dbg_ctx2);
     728        lock(cltr->thread_list_lock __cfaabi_dbg_ctx2);
    729729        {
    730730                tytagref( dlink(thread$), dlink(thread$) ) ?`inner( thread$ & this ) = void;
Note: See TracChangeset for help on using the changeset viewer.