Changeset 9b1dcc2 for libcfa/src/concurrency/kernel.cfa
- Timestamp:
- Jun 12, 2020, 1:49:17 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- cb196f2
- Parents:
- b388ee81
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
rb388ee81 r9b1dcc2 300 300 // register the processor unless it's the main thread which is handled in the boot sequence 301 301 if(this != mainProcessor) { 302 this->id = doregister( this);302 this->id = doregister((__processor_id_t*)this); 303 303 ready_queue_grow( this->cltr ); 304 304 } … … 346 346 if(this != mainProcessor) { 347 347 ready_queue_shrink( this->cltr ); 348 unregister( this);348 unregister((__processor_id_t*)this); 349 349 } 350 350 else { … … 416 416 if(unlikely(thrd_dst->preempted != __NO_PREEMPTION)) { 417 417 // The thread was preempted, reschedule it and reset the flag 418 __schedule_thread( thrd_dst );418 __schedule_thread( (__processor_id_t*)this, thrd_dst ); 419 419 break RUNNING; 420 420 } … … 609 609 // Scheduler routines 610 610 // KERNEL ONLY 611 void __schedule_thread( $thread * thrd ) {611 void __schedule_thread( struct __processor_id_t * id, $thread * thrd ) { 612 612 /* paranoid */ verify( thrd ); 613 613 /* paranoid */ verify( thrd->state != Halted ); … … 623 623 if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready; 624 624 625 ready_schedule_lock ( kernelTLS.this_processor);625 ready_schedule_lock ( id ); 626 626 push( thrd->curr_cluster, thrd ); 627 627 628 628 __wake_one(thrd->curr_cluster); 629 ready_schedule_unlock( kernelTLS.this_processor);629 ready_schedule_unlock( id ); 630 630 631 631 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); … … 636 636 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 637 637 638 ready_schedule_lock (kernelTLS.this_processor );638 ready_schedule_lock ( (__processor_id_t*)kernelTLS.this_processor ); 639 639 $thread * head = pop( this ); 640 ready_schedule_unlock( kernelTLS.this_processor );640 ready_schedule_unlock( (__processor_id_t*)kernelTLS.this_processor ); 641 641 642 642 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); … … 645 645 646 646 // KERNEL ONLY unpark with out disabling interrupts 647 void __unpark( $thread * thrd __cfaabi_dbg_ctx_param2 ) {647 void __unpark( struct __processor_id_t * id, $thread * thrd __cfaabi_dbg_ctx_param2 ) { 648 648 static_assert(sizeof(thrd->state) == sizeof(int)); 649 649 … … 663 663 // Wake lost the race, 664 664 thrd->state = Blocked; 665 __schedule_thread( thrd );665 __schedule_thread( id, thrd ); 666 666 break; 667 667 case Rerun: … … 681 681 682 682 disable_interrupts(); 683 __unpark( thrd __cfaabi_dbg_ctx_fwd2 );683 __unpark( (__processor_id_t*)kernelTLS.this_processor, thrd __cfaabi_dbg_ctx_fwd2 ); 684 684 enable_interrupts( __cfaabi_dbg_ctx ); 685 685 } … … 798 798 (*mainProcessor){}; 799 799 800 mainProcessor->id = doregister( mainProcessor);800 mainProcessor->id = doregister( (__processor_id_t*)mainProcessor); 801 801 802 802 //initialize the global state variables … … 809 809 // Add the main thread to the ready queue 810 810 // once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread 811 __schedule_thread( mainThread);811 __schedule_thread((__processor_id_t *)mainProcessor, mainThread); 812 812 813 813 // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX … … 853 853 kernel_stop_preemption(); 854 854 855 unregister( mainProcessor);855 unregister((__processor_id_t*)mainProcessor); 856 856 857 857 // Destroy the main processor and its context in reverse order of construction
Note: See TracChangeset
for help on using the changeset viewer.