Ignore:
File:
1 edited

Legend:

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

    r24e321c rd874f59  
    200200        __cfadbg_print_safe(runtime_core, "Kernel : Main cluster ready\n");
    201201
    202         // Construct the processor context of the main processor
    203         void ?{}(processorCtx_t & this, processor * proc) {
    204                 (this.__cor){ "Processor" };
    205                 this.__cor.starter = 0p;
    206                 this.proc = proc;
    207         }
    208 
    209         void ?{}(processor & this) with( this ) {
    210                 ( this.terminated ){};
    211                 ( this.runner ){};
    212                 init( this, "Main Processor", *mainCluster, 0p );
    213                 kernel_thread = pthread_self();
    214 
    215                 runner{ &this };
    216                 __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner);
    217         }
    218 
    219         // Initialize the main processor and the main processor ctx
    220         // (the coroutine that contains the processing control flow)
    221         mainProcessor = (processor *)&storage_mainProcessor;
    222         (*mainProcessor){};
    223 
    224         register_tls( mainProcessor );
    225 
    226202        // Start by initializing the main thread
    227203        // SKULLDUGGERY: the mainThread steals the process main thread
     
    234210        __cfadbg_print_safe(runtime_core, "Kernel : Main thread ready\n");
    235211
     212
     213
     214        // Construct the processor context of the main processor
     215        void ?{}(processorCtx_t & this, processor * proc) {
     216                (this.__cor){ "Processor" };
     217                this.__cor.starter = 0p;
     218                this.proc = proc;
     219        }
     220
     221        void ?{}(processor & this) with( this ) {
     222                ( this.terminated ){};
     223                ( this.runner ){};
     224                init( this, "Main Processor", *mainCluster, 0p );
     225                kernel_thread = pthread_self();
     226
     227                runner{ &this };
     228                __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner);
     229        }
     230
     231        // Initialize the main processor and the main processor ctx
     232        // (the coroutine that contains the processing control flow)
     233        mainProcessor = (processor *)&storage_mainProcessor;
     234        (*mainProcessor){};
     235
     236        register_tls( mainProcessor );
     237        mainThread->last_cpu = __kernel_getcpu();
     238
    236239        //initialize the global state variables
    237240        __cfaabi_tls.this_processor = mainProcessor;
     
    249252        // Add the main thread to the ready queue
    250253        // once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread
    251         schedule_thread$(mainThread, UNPARK_LOCAL);
     254        schedule_thread$(mainThread);
    252255
    253256        // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX
     
    483486        link.next = 0p;
    484487        link.ts   = -1llu;
    485         preferred = ready_queue_new_preferred();
     488        preferred = -1u;
    486489        last_proc = 0p;
    487490        #if defined( __CFA_WITH_VERIFY__ )
Note: See TracChangeset for help on using the changeset viewer.