Ignore:
Timestamp:
Jan 29, 2018, 6:08:07 PM (4 years ago)
Author:
alain
Message:

blip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/thread.c

    r418 r428  
    141141
    142142    // register new thread in process descriptor, and get a TRDID
    143     spinlock_lock( &process->th_lock );
    144143    error = process_register_thread( process, thread , &trdid );
    145     spinlock_unlock( &process->th_lock );
    146144
    147145    if( error )
     
    228226
    229227    assert( (attr != NULL) , __FUNCTION__, "pthread attributes must be defined" );
     228
     229thread_dmsg("\n[DBG] %s : core[%x,%d] enter for process %x\n",
     230__FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid );
    230231
    231232    // get process descriptor local copy
     
    290291                         vseg->min,
    291292                         vseg->max - vseg->min );
    292 
    293293    if( error )
    294294    {
     
    326326    dqdt_local_update_threads( 1 );
    327327
    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 );
     328thread_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 );
    331330
    332331    *new_thread = thread;
     
    371370
    372371    // 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 ));
    379378
    380379    vpn_base = base >> CONFIG_PPM_PAGE_SHIFT;
     
    419418
    420419    // 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 );
    424423 
    425424
     
    515514        thread_t     * thread;       // pointer on new thread descriptor
    516515
    517 thread_dmsg("\n[DBG] %s : core[%x,%d] enters / type % / cycle %d\n",
     516thread_dmsg("\n[DBG] %s : core[%x,%d] enters / type %s / cycle %d\n",
    518517__FUNCTION__ , local_cxy , core_lid , thread_type_str( type ) , hal_time_stamp() );
    519518
     
    615614        if ( thread->type == THREAD_USER ) hal_fpu_context_destroy( thread );
    616615       
    617     // release FPU if required
    618     // TODO This should be done before calling thread_destroy()
     616    // release FPU ownership if required
    619617        hal_disable_irq( &save_sr );
    620618        if( core->fpu_owner == thread )
     
    626624
    627625    // 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 );
    635627       
    636628    // update local DQDT
     
    814806
    815807thread_dmsg("\n[DBG] %s : killer thread %x enter for target thread %x\n",
    816 __FUNCTION__, local_cxy, killer->trdid , target trdid );
     808__FUNCTION__, local_cxy, killer->trdid , target->trdid );
    817809
    818810    // set the global blocked bit in target thread descriptor.
     
    844836
    845837thread_dmsg("\n[DBG] %s : killer thread %x exit for target thread %x\n",
    846 __FUNCTION__, local_cxy, killer->trdid , target trdid );
     838__FUNCTION__, local_cxy, killer->trdid , target->trdid );
    847839
    848840}  // end thread_kill()
Note: See TracChangeset for help on using the changeset viewer.