Changeset 428 for trunk/kernel/kern/thread.c
- Timestamp:
- Jan 29, 2018, 6:08:07 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/thread.c
r418 r428 141 141 142 142 // register new thread in process descriptor, and get a TRDID 143 spinlock_lock( &process->th_lock );144 143 error = process_register_thread( process, thread , &trdid ); 145 spinlock_unlock( &process->th_lock );146 144 147 145 if( error ) … … 228 226 229 227 assert( (attr != NULL) , __FUNCTION__, "pthread attributes must be defined" ); 228 229 thread_dmsg("\n[DBG] %s : core[%x,%d] enter for process %x\n", 230 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid ); 230 231 231 232 // get process descriptor local copy … … 290 291 vseg->min, 291 292 vseg->max - vseg->min ); 292 293 293 if( error ) 294 294 { … … 326 326 dqdt_local_update_threads( 1 ); 327 327 328 thread_dmsg("\n[DBG] %s : core[%x,%d] exit / trdid = %x / process %x / core = %d\n", 329 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, 330 thread->trdid , process->pid , core_lid ); 328 thread_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x / trdid = %x / core = %d\n", 329 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid, thread->trdid, core_lid ); 331 330 332 331 *new_thread = thread; … … 371 370 372 371 // get relevant fields from parent thread 373 func = (void *) hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->entry_func ));374 args = (void *) hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->entry_args ));375 base = (intptr_t)hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->u_stack_base ));376 size = (uint32_t)hal_remote_lw ( XPTR( parent_cxy , &parent_ptr->u_stack_size ));377 flags = hal_remote_lw ( XPTR( parent_cxy , &parent_ptr->flags ));378 uzone = (reg_t *) hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->uzone ));372 func = (void *) hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->entry_func )); 373 args = (void *) hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->entry_args )); 374 base = (intptr_t)hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->u_stack_base )); 375 size = (uint32_t)hal_remote_lw ( XPTR( parent_cxy , &parent_ptr->u_stack_size )); 376 flags = hal_remote_lw ( XPTR( parent_cxy , &parent_ptr->flags )); 377 uzone = (reg_t *) hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->uzone_current )); 379 378 380 379 vpn_base = base >> CONFIG_PPM_PAGE_SHIFT; … … 419 418 420 419 // update uzone pointer in child thread descriptor 421 child_ptr->uzone = (char *)((intptr_t)uzone +422 (intptr_t)child_ptr -423 (intptr_t)parent_ptr );420 child_ptr->uzone_current = (char *)((intptr_t)uzone + 421 (intptr_t)child_ptr - 422 (intptr_t)parent_ptr ); 424 423 425 424 … … 515 514 thread_t * thread; // pointer on new thread descriptor 516 515 517 thread_dmsg("\n[DBG] %s : core[%x,%d] enters / type % / cycle %d\n",516 thread_dmsg("\n[DBG] %s : core[%x,%d] enters / type %s / cycle %d\n", 518 517 __FUNCTION__ , local_cxy , core_lid , thread_type_str( type ) , hal_time_stamp() ); 519 518 … … 615 614 if ( thread->type == THREAD_USER ) hal_fpu_context_destroy( thread ); 616 615 617 // release FPU if required 618 // TODO This should be done before calling thread_destroy() 616 // release FPU ownership if required 619 617 hal_disable_irq( &save_sr ); 620 618 if( core->fpu_owner == thread ) … … 626 624 627 625 // remove thread from process th_tbl[] 628 // TODO This should be done before calling thread_destroy() 629 ltid_t ltid = LTID_FROM_TRDID( thread->trdid ); 630 631 spinlock_lock( &process->th_lock ); 632 process->th_tbl[ltid] = XPTR_NULL; 633 process->th_nr--; 634 spinlock_unlock( &process->th_lock ); 626 process_remove_thread( thread ); 635 627 636 628 // update local DQDT … … 814 806 815 807 thread_dmsg("\n[DBG] %s : killer thread %x enter for target thread %x\n", 816 __FUNCTION__, local_cxy, killer->trdid , target 808 __FUNCTION__, local_cxy, killer->trdid , target->trdid ); 817 809 818 810 // set the global blocked bit in target thread descriptor. … … 844 836 845 837 thread_dmsg("\n[DBG] %s : killer thread %x exit for target thread %x\n", 846 __FUNCTION__, local_cxy, killer->trdid , target 838 __FUNCTION__, local_cxy, killer->trdid , target->trdid ); 847 839 848 840 } // end thread_kill()
Note: See TracChangeset
for help on using the changeset viewer.