Ignore:
Timestamp:
Feb 14, 2018, 3:40:19 PM (4 years ago)
Author:
alain
Message:

blip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_exit.c

    r416 r433  
    3636int sys_exit( uint32_t status )
    3737{
    38     uint32_t    save_sr;       // required to enable IRQs
     38    reg_t       save_sr;       // required to enable IRQs
    3939
    40     thread_t  * this = CURRENT_THREAD;
    41     pid_t       pid  = this->process->pid;
     40    thread_t  * this    = CURRENT_THREAD;
     41    process_t * process = this->process;
     42    pid_t       pid     = process->pid;
    4243
    43 #if CONFIG_SYSCALL_DEBUG
     44#if CONFIG_DEBUG_SYS_EXIT
    4445uint64_t    tm_start;
    4546uint64_t    tm_end;
    4647tm_start = hal_get_cycles();
    47 printk("\n[DBG] %s : core[%x,%d] enter / process %x / status %x / cycle %d\n",
    48 __FUNCTION__ , local_cxy , this->core->lid , pid , status , (uint32_t)tm_start );
     48if( CONFIG_DEBUG_SYS_EXIT < tm_start )
     49printk("\n[DBG] %s : thread %x enter / process %x / status %x / cycle %d\n",
     50__FUNCTION__ , this, pid , status , (uint32_t)tm_start );
    4951#endif
    5052
    51     // get owner process cluster
    52     cxy_t   owner_cxy  = CXY_FROM_PID( pid );
     53    // get cluster and pointers on process in owner cluster
     54    xptr_t      owner_xp  = cluster_get_owner_process_from_pid( pid );
     55    cxy_t       owner_cxy = GET_CXY( owner_xp );
     56    process_t * owner_ptr = GET_PTR( owner_xp );
     57
     58    assert( (owner_xp != XPTR_NULL) , __FUNCTION__ , "owner_xp cannot be NULL\n" );
    5359
    5460    // enable IRQs
    5561    hal_enable_irq( &save_sr );
    5662
    57     // execute process_make_exit() function in owner cluster
    58     if( local_cxy == owner_cxy )                                // owner is local
    59     {
    60         process_make_exit( pid , status );
    61     }
    62     else                                                        // owner is remote
    63     {
    64         rpc_process_make_exit_client( owner_cxy, pid , status );
    65     }
     63    // the process_make_kill() function must be executed
     64    // by an RPC thread in reference cluster
     65    rpc_process_make_kill_client( owner_cxy, owner_ptr, true , status );
    6666
    6767    // restore IRQs
     
    7070    hal_fence();
    7171
    72 #if CONFIG_SYSCALL_DEBUG
     72#if CONFIG_DEBUG_SYS_EXIT
    7373tm_end = hal_get_cycles();
    74 printk("\n[DBG] %s : core[%x,%d] exit / process %x / status %x / cost = %d\n",
    75 __FUNCTION__ , local_cxy , this->core->lid , pid , status , (uint32_t)(tm_end - tm_start) );
     74if( CONFIG_DEBUG_SYS_EXIT < tm_end )
     75printk("\n[DBG] %s : thread %x exit / process %x / status %x / cost = %d / cycle %d\n",
     76__FUNCTION__, this, pid, status, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
    7677#endif
    7778
Note: See TracChangeset for help on using the changeset viewer.