- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel/startup.cfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/startup.cfa
r24e321c rd874f59 200 200 __cfadbg_print_safe(runtime_core, "Kernel : Main cluster ready\n"); 201 201 202 // Construct the processor context of the main processor203 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 ctx220 // (the coroutine that contains the processing control flow)221 mainProcessor = (processor *)&storage_mainProcessor;222 (*mainProcessor){};223 224 register_tls( mainProcessor );225 226 202 // Start by initializing the main thread 227 203 // SKULLDUGGERY: the mainThread steals the process main thread … … 234 210 __cfadbg_print_safe(runtime_core, "Kernel : Main thread ready\n"); 235 211 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 236 239 //initialize the global state variables 237 240 __cfaabi_tls.this_processor = mainProcessor; … … 249 252 // Add the main thread to the ready queue 250 253 // 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); 252 255 253 256 // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX … … 483 486 link.next = 0p; 484 487 link.ts = -1llu; 485 preferred = ready_queue_new_preferred();488 preferred = -1u; 486 489 last_proc = 0p; 487 490 #if defined( __CFA_WITH_VERIFY__ )
Note:
See TracChangeset
for help on using the changeset viewer.