Ignore:
Timestamp:
Aug 2, 2018, 11:47:13 AM (6 years ago)
Author:
alain
Message:

This version modifies the exec syscall and fixes a large number of small bugs.
The version number has been updated (0.1)

File:
1 edited

Legend:

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

    r446 r457  
    2323
    2424#include <kernel_config.h>
    25 #include <hal_types.h>
     25#include <hal_kernel_types.h>
    2626#include <hal_irqmask.h>
    2727#include <errno.h>
     
    5959tm_start = hal_get_cycles();
    6060if( DEBUG_SYS_EXIT < tm_start )
    61 printk("\n[DBG] %s : thread %x enter / process %x / status %x / cycle %d\n",
    62 __FUNCTION__ , this, pid , status , (uint32_t)tm_start );
     61printk("\n[DBG] %s : thread %x in process %x enter / status %x / cycle %d\n",
     62__FUNCTION__, this->trdid, process->pid , status , (uint32_t)tm_start );
    6363#endif
    6464
     
    7070#if (DEBUG_SYS_EXIT & 1)
    7171if( DEBUG_SYS_EXIT < tm_start )
    72 printk("\n[DBG] %s : thread %x get owner process %x in cluster %x\n",
    73 __FUNCTION__ , this, owner_ptr, owner_cxy );
     72printk("\n[DBG] %s : thread %x in process %x get owner process %x in cluster %x\n",
     73__FUNCTION__, this->trdid, process->pid, owner_ptr, owner_cxy );
    7474#endif
    7575
    76     // get pointer on the process main thread
     76    // get local pointer on the process main thread
    7777    main_ptr  = hal_remote_lpt( XPTR( owner_cxy , &owner_ptr->th_tbl[0] ) );
    7878
     
    8484#if (DEBUG_SYS_EXIT & 1)
    8585if( DEBUG_SYS_EXIT < tm_start )
    86 printk("\n[DBG] %s : thread %x get parent process %x in cluster %x\n",
    87 __FUNCTION__ , this, parent_ptr, parent_cxy );
     86printk("\n[DBG] %s : thread %x in process %x get parent process %x in cluster %x\n",
     87__FUNCTION__, this->trdid, process->pid, parent_ptr, parent_cxy );
    8888#endif
    8989
     
    9999
    100100#if( DEBUG_SYS_EXIT & 1)
    101 if( tm_start > DEBUG_SYS_EXIT )
    102 printk("\n[DBG] %s : thread %x removed process %x from TXT list\n",
    103 __FUNCTION__ , this, pid );
     101if( DEBUG_SYS_EXIT < tm_start )
     102printk("\n[DBG] %s : thread %x in process %x detached process from TXT\n",
     103__FUNCTION__, this->trdid, process->pid );
    104104#endif
    105105
     
    107107    // but the main thread and this calling thread
    108108    hal_enable_irq( &save_sr );
    109     process_sigaction( pid , DELETE_ALL_THREADS );
     109    process_sigaction( process->pid , DELETE_ALL_THREADS );
    110110    hal_restore_irq( save_sr );
    111111
    112112#if( DEBUG_SYS_EXIT & 1)
    113 if( tm_start > DEBUG_SYS_EXIT )
    114 printk("\n[DBG] %s : thread %x deleted threads for process %x\n",
    115 __FUNCTION__ , this, pid );
     113if( DEBUG_SYS_EXIT < tm_start )
     114printk("\n[DBG] %s : thread %x in process %x deleted all threads but itself\n",
     115__FUNCTION__, this->trdid, process->pid );
    116116#endif
    117117
     
    122122#if( DEBUG_SYS_EXIT & 1)
    123123if( tm_start > DEBUG_SYS_EXIT )
    124 printk("\n[DBG] %s : calling thread %x marked iself for delete in process %x\n",
    125 __FUNCTION__ , this, pid );
     124printk("\n[DBG] %s : thread %x in process %x marked iself for delete\n",
     125__FUNCTION__, this->trdid, process->pid );
    126126#endif
    127127        thread_delete( XPTR( local_cxy , this ) , pid , true );
     
    133133#if( DEBUG_SYS_EXIT & 1)
    134134if( tm_start > DEBUG_SYS_EXIT )
    135 printk("\n[DBG] %s : thread %x blocked main thread for process %x\n",
    136 __FUNCTION__, this , pid );
     135printk("\n[DBG] %s : thread %x in process %x blocked main thread\n",
     136__FUNCTION__, this->trdid, process->pid );
    137137#endif
    138138
     
    144144#if( DEBUG_SYS_EXIT & 1)
    145145if( tm_start > DEBUG_SYS_EXIT )
    146 printk("\n[DBG] %s : thread %x set exit status in process %x / term_state %x\n",
    147 __FUNCTION__ , this, pid, term_state );
     146printk("\n[DBG] %s : thread %x in process %x set exit status %x in owner process\n",
     147__FUNCTION__, this->trdid, process->pid, term_state );
    148148#endif
    149149
    150     // take the children lock and unblock the parent process main thread
     150    // unblock the parent process main thread
    151151    remote_spinlock_lock( children_lock_xp );
    152152    thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT );
     
    155155#if( DEBUG_SYS_EXIT & 1)
    156156if( tm_start > DEBUG_SYS_EXIT )
    157 printk("\n[DBG] %s : thread %x in cluster %x unblock parent main thread %x in cluster %x\n",
    158 __FUNCTION__ , this, local_cxy, parent_main_ptr, parent_cxy );
     157printk("\n[DBG] %s : thread %x in process %x unblock parent main thread in process %x\n",
     158__FUNCTION__ , this->trdid, process->pid,
     159hal_remote_lw( XPTR( parent_cxy , &parent_ptr->pid) ) );
    159160#endif
    160161
     
    164165tm_end = hal_get_cycles();
    165166if( DEBUG_SYS_EXIT < tm_end )
    166 printk("\n[DBG] %s : thread %x exit / process %x / status %x / cost = %d / cycle %d\n",
    167 __FUNCTION__, this, pid, status, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     167printk("\n[DBG] %s : thread %x in process %x exit / status %x / cost = %d / cycle %d\n",
     168__FUNCTION__, this->trdid, process->pid, status,
     169(uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
    168170#endif
    169171
Note: See TracChangeset for help on using the changeset viewer.