Changeset 433 for trunk/kernel/syscalls/sys_exit.c
- Timestamp:
- Feb 14, 2018, 3:40:19 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_exit.c
r416 r433 36 36 int sys_exit( uint32_t status ) 37 37 { 38 uint32_tsave_sr; // required to enable IRQs38 reg_t save_sr; // required to enable IRQs 39 39 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; 42 43 43 #if CONFIG_ SYSCALL_DEBUG44 #if CONFIG_DEBUG_SYS_EXIT 44 45 uint64_t tm_start; 45 46 uint64_t tm_end; 46 47 tm_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 ); 48 if( CONFIG_DEBUG_SYS_EXIT < tm_start ) 49 printk("\n[DBG] %s : thread %x enter / process %x / status %x / cycle %d\n", 50 __FUNCTION__ , this, pid , status , (uint32_t)tm_start ); 49 51 #endif 50 52 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" ); 53 59 54 60 // enable IRQs 55 61 hal_enable_irq( &save_sr ); 56 62 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 ); 66 66 67 67 // restore IRQs … … 70 70 hal_fence(); 71 71 72 #if CONFIG_ SYSCALL_DEBUG72 #if CONFIG_DEBUG_SYS_EXIT 73 73 tm_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) ); 74 if( CONFIG_DEBUG_SYS_EXIT < tm_end ) 75 printk("\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 ); 76 77 #endif 77 78
Note: See TracChangeset
for help on using the changeset viewer.