Changeset 435 for trunk/kernel


Ignore:
Timestamp:
Feb 20, 2018, 5:32:17 PM (7 years ago)
Author:
alain
Message:

Fix a bad bug in scheduler...

Location:
trunk/kernel
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_txt.c

    r433 r435  
    3838extern chdev_directory_t  chdev_dir;         // allocated in kernel_init.c
    3939
    40 #if CONFIG_READ_DEBUG
     40#if (CONFIG_DEBUG_SYS_READ & 1)
    4141extern uint32_t enter_txt_read;
    4242extern uint32_t exit_txt_read;
    4343#endif
     44
     45#if (CONFIG_DEBUG_SYS_WRITE & 1)
     46extern uint32_t enter_txt_write;
     47extern uint32_t exit_txt_write;
     48#endif
     49
     50////////////////////////////////////////
     51char * dev_txt_type_str( uint32_t type )
     52{
     53    if     ( type == TXT_SYNC_WRITE ) return "TXT_SYNC_WRITE";
     54    else if( type == TXT_READ       ) return "TXT_READ";
     55    else if( type == TXT_WRITE      ) return "TXT_WRITE";
     56    else                              return "undefined";
     57}
    4458
    4559//////////////////////////////////
     
    117131    thread_t * this = CURRENT_THREAD;
    118132
     133#if (CONFIG_DEBUG_SYS_READ & 1)
     134enter_txt_read = hal_time_stamp();
     135#endif
     136
     137#if (CONFIG_DEBUG_SYS_WRITE & 1)
     138enter_txt_write = hal_time_stamp();
     139#endif
     140
    119141#if CONFIG_DEBUG_DEV_TXT
    120142uint32_t cycle = (uint32_t)hal_get_cycles();
     
    151173#endif
    152174
     175#if (CONFIG_DEBUG_SYS_READ & 1)
     176exit_txt_read = hal_time_stamp();
     177#endif
     178
     179#if (CONFIG_DEBUG_SYS_WRITE & 1)
     180exit_txt_write = hal_time_stamp();
     181#endif
     182
    153183    // return I/O operation status from calling thread descriptor
    154184    return this->txt_cmd.error;
     
    160190                       uint32_t   count )
    161191{
    162     error_t error = dev_txt_access( TXT_WRITE , channel , buffer , count );
    163     return error;
     192    return dev_txt_access( TXT_WRITE , channel , buffer , count );
    164193}
    165194
     
    168197                      char     * buffer )
    169198{
    170 
    171 #if CONFIG_READ_DEBUG
    172 enter_txt_read = hal_time_stamp();
    173 #endif
    174 
    175     error_t error = dev_txt_access( TXT_READ , channel , buffer , 1 );
    176 
    177 #if CONFIG_READ_DEBUG
    178 exit_txt_read = hal_time_stamp();
    179 #endif
    180 
    181     return error;
    182 
     199    return dev_txt_access( TXT_READ , channel , buffer , 1 );
    183200}
    184201
     
    201218
    202219    // build arguments structure
    203     txt_aux_t  args;
     220    txt_sync_args_t  args;
    204221    args.dev_xp = dev_xp;
    205222    args.buffer = buffer;
  • trunk/kernel/devices/dev_txt.h

    r422 r435  
    8282    TXT_READ       = 0,
    8383    TXT_WRITE      = 1,
     84    TXT_SYNC_WRITE = 2,
    8485};
    8586
     
    8788{
    8889    xptr_t      dev_xp;    /*! extended pointer on the relevant TXT device descriptor    */
    89     uint32_t    type;      /*! TXT_READ / TXT_WRITE / TXT_SYNC_WRITE                     */
     90    uint32_t    type;      /*! TXT_READ / TXT_WRITE                                      */
    9091    xptr_t      buf_xp;    /*! extended pointer on characters array                      */
    9192    uint32_t    count;     /*! number of characters in buffer (must be 1 if to_mem)      */
     
    99100 *****************************************************************************************/
    100101
    101 typedef struct txt_aux_s
     102typedef struct txt_sync_args_s
    102103{
    103     xptr_t      dev_xp;    /*! extended pointer on the TXT0 device descriptor            */
     104    xptr_t      dev_xp;    /*! extended pointer on the TXT0_TX device descriptor            */
    104105    char      * buffer;    /*! local pointer on characters array                         */
    105106    uint32_t    count;     /*! number of characters in buffer                            */
    106107}
    107 txt_aux_t;
     108txt_sync_args_t;
     109
     110/******************************************************************************************
     111 * This function returns a printable string for the comman type.
     112 ******************************************************************************************
     113 * @ type     : command type (TXT_READ / TXT_WRITE / TXT_SYNC_WRITE)
     114 *****************************************************************************************/
     115char * dev_txt_type_str( uint32_t type );
    108116
    109117/******************************************************************************************
     
    157165 * As it is used for debug, the command arguments <buffer> and <count> are registerd
    158166 * in a specific "dbg_cmd" field of the calling thread.
    159  * other TXT accesses.
    160167 ****************************************************************************************
    161168 * @ buffer    : local pointer on source buffer containing the string.
  • trunk/kernel/fs/devfs.c

    r433 r435  
    4242extern chdev_directory_t    chdev_dir;      // allocated in kernel_init.c
    4343
    44 #if CONFIG_READ_DEBUG
    45 extern uint32_t  enter_devfs_move;
    46 extern uint32_t  exit_devfs_move;
     44#if (CONFIG_DEBUG_SYS_READ & 1)
     45extern uint32_t  enter_devfs_read;
     46extern uint32_t  exit_devfs_read;
     47#endif
     48
     49#if (CONFIG_DEBUG_SYS_WRITE & 1)
     50extern uint32_t  enter_devfs_write;
     51extern uint32_t  exit_devfs_write;
    4752#endif
    4853
     
    375380    char               k_buf[CONFIG_TXT_KBUF_SIZE];  // local kernel buffer
    376381
     382#if (CONFIG_DEBUG_SYS_READ & 1)
     383enter_devfs_read = hal_time_stamp();
     384#endif
     385
     386#if (CONFIG_DEBUG_SYS_WRITE & 1)
     387enter_devfs_write = hal_time_stamp();
     388#endif
     389
    377390#if CONFIG_DEBUG_DEVFS_MOVE
    378391uint32_t cycle = (uint32_t)hal_get_cycles();
     
    380393printk("\n[DBG] %s : thread %x enter / to_mem %d / cycle %d\n",
    381394__FUNCTION__ , CURRENT_THREAD , to_buffer , cycle );
    382 #endif
    383 
    384 #if CONFIG_READ_DEBUG
    385 enter_devfs_move = hal_time_stamp();
    386395#endif
    387396
     
    424433#endif
    425434
    426 #if CONFIG_READ_DEBUG
    427 exit_devfs_move = hal_time_stamp();
     435#if (CONFIG_DEBUG_SYS_READ & 1)
     436exit_devfs_read = hal_time_stamp();
    428437#endif
    429438            return size;
     
    448457#endif
    449458
     459#if (CONFIG_DEBUG_SYS_WRITE & 1)
     460exit_devfs_write = hal_time_stamp();
     461#endif
    450462                return size;
    451463            }
  • trunk/kernel/fs/fatfs.c

    r407 r435  
    262262    "no FAT access required for first page\n");
    263263
    264 fatfs_dmsg("\n[DBG] %s : core[%x,%d] enters / first_cluster_id = %d / searched_index = %d\n",
    265 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, first_cluster_id, searched_page_index );
     264#if CONFIG_DEBUG_FATFS_GET_CLUSTER
     265uint32_t cycle = (uint32_t)hal_get_cycles();
     266if( CONFIG_DEBUG_FATFS_GET_CLUSTER < cycle )
     267printk("\n[DBG] %s : thread %x enter / first_cluster_id %d / searched_index / cycle %d\n",
     268__FUNCTION__, CURRENT_THREAD, first_cluster_id, searched_page_index, cycle );
     269#endif
    266270
    267271    // get number of FAT slots per page
     
    289293        next_cluster_id = current_page_buffer[current_page_offset];
    290294
    291 fatfs_dmsg("\n[DBG] %s : core[%x,%d] traverse FAT / current_page_index = %d\n"
     295#if (CONFIG_DEBUG_FATFS_GET_CLUSTER & 1)
     296if( CONFIG_DEBUG_FATFS_GET_CLUSTER < cycle )
     297printk("\n[DBG] %s : traverse FAT / current_page_index = %d\n"
    292298"current_page_offset = %d / next_cluster_id = %d\n",
    293 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, current_page_index,
    294 current_page_offset , next_cluster_id );
     299__FUNCTION__, current_page_index, current_page_offset , next_cluster_id );
     300#endif
    295301
    296302        // update loop variables
     
    302308    if( next_cluster_id == 0xFFFFFFFF ) return EIO;
    303309   
    304 fatfs_dmsg("\n[DBG] %s : core[%x;%d] exit / cluster_id = %d\n",
    305 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, next_cluster_id );
     310#if CONFIG_DEBUG_FATFS_GET_CLUSTER
     311cycle = (uint32_t)hal_get_cycles();
     312if( CONFIG_DEBUG_FATFS_GET_CLUSTER < cycle )
     313printk("\n[DBG] %s : thread %x exit / searched_cluster_id = %d / cycle %d\n",
     314__FUNCTION__, CURRENT_THREAD, next_cluster_id / cycle );
     315#endif
    306316
    307317    *searched_cluster_id = next_cluster_id;
     
    335345    uint8_t     * buffer;
    336346
    337     fatfs_dmsg("\n[DBG] %s : enter for fatfs_ctx = %x\n",
    338                __FUNCTION__ , fatfs_ctx );
     347#if CONFIG_DEBUG_FATFS_INIT
     348uint32_t cycle = (uint32_t)hal_get_cycles();
     349if( CONFIG_DEBUG_FATFS_INIT < cycle )
     350printk("\n[DBG] %s : thread %x enter for fatfs_ctx = %x / cycle %d\n",
     351__FUNCTION__ , CURRENT_THREAD , fatfs_ctx , cycle );
     352#endif
    339353
    340354    assert( (fatfs_ctx != NULL) , __FUNCTION__ ,
    341                    "cannot allocate memory for FATFS context\n" );
     355    "cannot allocate memory for FATFS context\n" );
    342356
    343357    // allocate a 512 bytes buffer to store the boot record
     
    347361
    348362    assert( (buffer != NULL) , __FUNCTION__ ,
    349                    "cannot allocate memory for 512 bytes buffer\n" );
     363    "cannot allocate memory for 512 bytes buffer\n" );
    350364     
    351     fatfs_dmsg("\n[DBG] %s : allocated 512 bytes buffer\n", __FUNCTION__ );
    352 
    353365    // load the boot record from device
    354366    // using a synchronous access to IOC device 
    355367    error = dev_ioc_sync_read( buffer , 0 , 1 );
    356368
    357 fatfs_dmsg("\n[DBG] %s : buffer loaded\n", __FUNCTION__ );
    358 
    359     assert( (error == 0) , __FUNCTION__ , "cannot access boot record\n" );
    360 
    361 #if (CONFIG_FATFS_DEBUG & 0x1)
    362 if( hal_time_stamp() > CONFIG_FATFS_DEBUG )
     369    assert( (error == 0) , __FUNCTION__ ,
     370    "cannot access boot record\n" );
     371
     372#if (CONFIG_DEBUG_FATFS_INIT & 0x1)
     373if( CONFIG_DEBUG_FATFS_INIT < cycle )
    363374{
    364375    uint32_t   line;
     
    389400
    390401    assert( (nb_sectors == 8) , __FUNCTION__ ,
    391             "cluster size must be 8 sectors\n" );
     402    "cluster size must be 8 sectors\n" );
    392403
    393404    // check number of FAT copies from boot record
     
    395406
    396407    assert( (nb_fats == 1) , __FUNCTION__ ,
    397             "number of FAT copies must be 1\n" );
     408    "number of FAT copies must be 1\n" );
    398409
    399410    // get & check number of sectors in FAT from boot record
     
    401412
    402413    assert( ((fat_sectors & 0xF) == 0) , __FUNCTION__ ,
    403             "FAT not multiple of 16 sectors\n");
     414    "FAT not multiple of 16 sectors\n");
    404415
    405416    // get and check root cluster from boot record
     
    407418
    408419    assert( (root_cluster == 2) , __FUNCTION__ ,
    409             "root cluster index must be  2\n");
     420    "root cluster index must be  2\n");
    410421
    411422    // get FAT lba from boot record
     
    417428    kmem_free( &req );
    418429
    419     fatfs_dmsg("\n[DBG] %s : boot record read & released\n",
    420                __FUNCTION__ );
    421 
    422430    // allocate a mapper for the FAT itself
    423431    mapper_t * fat_mapper = mapper_create( FS_TYPE_FATFS );
    424432
    425     assert( (fat_mapper != NULL) , __FUNCTION__ , "no memory for FAT mapper" );
     433    assert( (fat_mapper != NULL) , __FUNCTION__ ,
     434    "no memory for FAT mapper" );
    426435
    427436    // WARNING : the inode field MUST be NULL for the FAT mapper
     
    439448    fatfs_ctx->fat_mapper_xp         = XPTR( local_cxy , fat_mapper );
    440449
    441 fatfs_dmsg("\n[DBG] %s : exit for fatfs_ctx = %x\n", __FUNCTION__ , fatfs_ctx );
     450#if CONFIG_DEBUG_FATFS_INIT
     451cycle = (uint32_t)hal_get_cycles();
     452if( CONFIG_DEBUG_FATFS_INIT < cycle )
     453printk("\n[DBG] %s : thread %x exit for fatfs_ctx = %x / cycle %d\n",
     454__FUNCTION__ , CURRENT_THREAD , fatfs_ctx , cycle );
     455#endif
    442456
    443457}  // end fatfs_ctx_init()
     
    472486    inode = mapper->inode;
    473487
    474 fatfs_dmsg("\n[DBG] %s : core[%x,%d] enter for page %d / inode %x / mapper %x\n",
    475 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , inode , mapper );
     488#if CONFIG_DEBUG_FATFS_MOVE
     489uint32_t cycle = (uint32_t)hal_get_cycles();
     490if( CONFIG_DEBUG_FATFS_MOVE < cycle )
     491printk("\n[DBG] %s : thread %x enter / page %d / inode %x / mapper %x / cycle %d\n",
     492__FUNCTION__ , CURRENT_THREAD , index , inode , mapper , cycle );
     493#endif
    476494
    477495    // get page base address
     
    489507        lba = fatfs_ctx->fat_begin_lba + (count * index);
    490508 
    491 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access FAT on device / lba = %d\n",
    492 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , lba );
     509#if (CONFIG_DEBUG_FATFS_MOVE & 0x1)
     510if( CONFIG_DEBUG_FATFS_MOVE < cycle )
     511printk("\n[DBG] %s : access FAT on device / lba = %d\n", __FUNCTION__ , lba );
     512#endif
    493513
    494514        // access device
     
    521541            {
    522542
    523 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access local FAT mapper\n"
     543#if (CONFIG_DEBUG_FATFS_MOVE & 0x1)
     544if( CONFIG_DEBUG_FATFS_MOVE < cycle )
     545print("\n[DBG] %s : access local FAT mapper\n"
    524546"fat_mapper_cxy = %x / fat_mapper_ptr = %x / first_cluster_id = %d / index = %d\n",
    525 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid ,
    526 fat_mapper_cxy , fat_mapper_ptr , first_cluster_id , index );
    527 
     547__FUNCTION__ , fat_mapper_cxy , fat_mapper_ptr , first_cluster_id , index );
     548#endif
    528549                error = fatfs_get_cluster( fat_mapper_ptr,
    529550                                           first_cluster_id,
     
    534555            {
    535556
    536 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access remote FAT mapper\n"
     557#if (CONFIG_DEBUG_FATFS_MOVE & 0x1)
     558if( CONFIG_DEBUG_FATFS_MOVE < cycle )
     559printk("\n[DBG] %s : access remote FAT mapper\n"
    537560"fat_mapper_cxy = %x / fat_mapper_ptr = %x / first_cluster_id = %d / index = %d\n",
    538 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid ,
    539 fat_mapper_cxy , fat_mapper_ptr , first_cluster_id , index );
    540 
     561__FUNCTION__ , fat_mapper_cxy , fat_mapper_ptr , first_cluster_id , index );
     562#endif
    541563                rpc_fatfs_get_cluster_client( fat_mapper_cxy,
    542564                                              fat_mapper_ptr,
     
    550572        }
    551573
    552 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access device for inode %x / cluster_id %d\n",
    553 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , inode , searched_cluster_id );
     574#if (CONFIG_DEBUG_FATFS_MOVE & 0x1)
     575if( CONFIG_DEBUG_FATFS_MOVE < cycle )
     576printk("\n[DBG] %s : access device for inode %x / cluster_id %d\n",
     577__FUNCTION__ , inode , searched_cluster_id );
     578#endif
    554579
    555580        // get lba from cluster_id
     
    563588    }
    564589
    565 fatfs_dmsg("\n[DBG] %s : core[%x,%d] exit for page %d / inode %x / mapper %x\n",
    566 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , inode , mapper );
    567 
    568 #if (CONFIG_FATFS_DEBUG & 0x1)
    569 if( hal_time_stamp() > CONFIG_FATFS_DEBUG )
     590#if CONFIG_DEBUG_FATFS_MOVE
     591cycle = (uint32_t)hal_get_cycles();
     592if( CONFIG_DEBUG_FATFS_MOVE < cycle )
     593printk("\n[DBG] %s : thread %x exit / page %d / inode %x / mapper %x / cycle %d\n",
     594__FUNCTION__ , CURRENT_THREAD , index , inode , mapper , cycle );
     595#endif
     596
     597#if (CONFIG_DEBUG_FATFS_MOVE & 0x1)
     598if( CONFIG_DEBUG_FATFS_MOVE < cycle )
    570599{
    571600    uint32_t * tab = (uint32_t *)buffer;
     
    594623    // - scan the directory entries in each 4 Kbytes page
    595624
    596 fatfs_dmsg("\n[DBG] %s : enter for child <%s> in parent inode %l\n",
    597 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) );
     625#if CONFIG_DEBUG_FATFS_LOAD
     626uint32_t cycle = (uint32_t)hal_get_cycles();
     627if( CONFIG_DEBUG_FATFS_LOAD < cycle )
     628printk("\n[DBG] %s : thread %x enter for child <%s> in parent inode %x / cycle %d\n",
     629__FUNCTION__ , CURRENT_THREAD , name , parent_inode , cycle );
     630#endif
    598631
    599632    mapper_t * mapper = parent_inode->mapper;
     
    632665        base = (uint8_t *)GET_PTR( base_xp );
    633666
    634 #if (CONFIG_FATFS_DEBUG & 0x1)
    635 if( hal_time_stamp() > CONFIG_FATFS_DEBUG )
     667#if (CONFIG_DEBUG_FATFS_LOAD & 0x1)
     668if( CONFIG_DEBUG_FATFS_LOAD < cycle )
    636669{
    637670    uint32_t * buf = (uint32_t *)base;
     
    716749    {
    717750
    718 fatfs_dmsg("\n[DBG] %s : exit / child <%s> not found in parent inode %l\n",
    719 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) );
     751#if CONFIG_DEBUG_FATFS_LOAD
     752cycle = (uint32_t)hal_get_cycles();
     753if( CONFIG_DEBUG_FATFS_LOAD < cycle )
     754printk("\n[DBG] %s : thread %x exit / child <%s> not found / cycle %d\n",
     755__FUNCTION__ , CURRENT_THREAD, name, cycle );
     756#endif
    720757
    721758        return ENOENT;
     
    734771        hal_remote_sw( XPTR( child_cxy , &child_ptr->extend ) , cluster );
    735772
    736 fatfs_dmsg("\n[DBG] %s : exit / child <%s> found in parent inode %l\n",
    737 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) );
     773#if CONFIG_DEBUG_FATFS_LOAD
     774cycle = (uint32_t)hal_get_cycles();
     775if( CONFIG_DEBUG_FATFS_LOAD < cycle )
     776printk("\n[DBG] %s : thread %x exit / child <%s> loaded / cycle %d\n",
     777__FUNCTION__ , CURRENT_THREAD, name, cycle );
     778#endif
    738779
    739780        return 0;
  • trunk/kernel/kern/chdev.c

    r433 r435  
    3939extern chdev_directory_t    chdev_dir;   // allocated in kernel_init.c
    4040
    41 #if CONFIG_READ_DEBUG
    42 extern uint32_t enter_chdev_cmd;
    43 extern uint32_t exit_chdev_cmd;
    44 extern uint32_t enter_chdev_server;
    45 extern uint32_t exit_chdev_server;
     41#if (CONFIG_DEBUG_SYS_READ & 1)
     42extern uint32_t enter_chdev_cmd_read;
     43extern uint32_t exit_chdev_cmd_read;
     44extern uint32_t enter_chdev_server_read;
     45extern uint32_t exit_chdev_server_read;
     46#endif
     47
     48#if (CONFIG_DEBUG_SYS_WRITE & 1)
     49extern uint32_t enter_chdev_cmd_write;
     50extern uint32_t exit_chdev_cmd_write;
     51extern uint32_t enter_chdev_server_write;
     52extern uint32_t exit_chdev_server_write;
    4653#endif
    4754
     
    123130    uint32_t   save_sr;       // for critical section
    124131
    125 #if CONFIG_READ_DEBUG
    126 enter_chdev_cmd = hal_time_stamp();
     132#if (CONFIG_DEBUG_SYS_READ & 1)
     133enter_chdev_cmd_read = (uint32_t)hal_get_cycles();
     134#endif
     135
     136#if (CONFIG_DEBUG_SYS_WRITE & 1)
     137enter_chdev_cmd_write = (uint32_t)hal_get_cycles();
    127138#endif
    128139
     
    178189    if( different ) dev_pic_send_ipi( chdev_cxy , lid );
    179190   
     191    // deschedule
     192    assert( thread_can_yield( this ) , __FUNCTION__ , "illegal sched_yield\n" );
     193    sched_yield("blocked on I/O");
     194
     195    // exit critical section
     196    hal_restore_irq( save_sr );
     197
    180198#if CONFIG_DEBUG_CHDEV_REGISTER_COMMAND
    181199cycle = (uint32_t)hal_get_cycles();
     
    185203#endif
    186204
    187     // deschedule
    188     assert( thread_can_yield( this ) , __FUNCTION__ , "illegal sched_yield\n" );
    189     sched_yield("blocked on I/O");
    190 
    191     // exit critical section
    192     hal_restore_irq( save_sr );
    193 
    194 #if CONFIG_DEBUG_CHDEV_REGISTER_COMMAND
    195 cycle = (uint32_t)hal_get_cycles();
    196 if( CONFIG_DEBUG_CHDEV_REGISTER_COMMAND < cycle )
    197 printk("\n[DBG] %s : client_thread %x (%s) resumes / cycle %d\n",
    198 __FUNCTION__, this, thread_type_str(this->type) , cycle );
    199 #endif
    200 
    201 #if CONFIG_READ_DEBUG
    202 exit_chdev_cmd = hal_time_stamp();
     205#if (CONFIG_DEBUG_SYS_READ & 1)
     206exit_chdev_cmd_read = (uint32_t)hal_get_cycles();
     207#endif
     208
     209#if (CONFIG_DEBUG_SYS_WRITE & 1)
     210exit_chdev_cmd_write = (uint32_t)hal_get_cycles();
    203211#endif
    204212
     
    240248            remote_spinlock_unlock( lock_xp );
    241249
    242 chdev_dmsg("\n[DBG] %s : thread %x deschedule /cycle %d\n",
    243 __FUNCTION__ , server , hal_time_stamp() );
    244 
    245250            // deschedule
    246251            sched_yield("I/O queue empty");
    247 
    248 chdev_dmsg("\n[DBG] %s : thread %x resume /cycle %d\n",
    249 __FUNCTION__ , server , hal_time_stamp() );
    250 
    251252        }
    252253        else                            // waiting queue not empty
    253254        {
    254255
    255 #if CONFIG_READ_DEBUG
    256 enter_chdev_server = hal_time_stamp();
    257 #endif
     256#if (CONFIG_DEBUG_SYS_READ & 1)
     257enter_chdev_server_read = (uint32_t)hal_get_cycles();
     258#endif
     259
     260#if (CONFIG_DEBUG_SYS_WRITE & 1)
     261enter_chdev_server_write = (uint32_t)hal_get_cycles();
     262#endif
     263
    258264            // release lock
    259265            remote_spinlock_unlock( lock_xp );
     
    284290#endif
    285291
    286 #if CONFIG_READ_DEBUG
    287 exit_chdev_server = hal_time_stamp();
     292#if (CONFIG_DEBUG_SYS_READ & 1)
     293exit_chdev_server_read = (uint32_t)hal_get_cycles();
     294#endif
     295
     296#if (CONFIG_DEBUG_SYS_WRITE & 1)
     297exit_chdev_server_write = (uint32_t)hal_get_cycles();
    288298#endif
    289299
  • trunk/kernel/kern/kernel_init.c

    r428 r435  
    123123
    124124
    125 // TODO remove these debug variables used dans sys_read()
     125// these debug variables are used to analyse the sys_read() syscall timing
    126126
    127127#if CONFIG_READ_DEBUG   
     
    129129uint32_t   exit_sys_read;
    130130
    131 uint32_t   enter_devfs_move;
    132 uint32_t   exit_devfs_move;
     131uint32_t   enter_devfs_read;
     132uint32_t   exit_devfs_read;
    133133
    134134uint32_t   enter_txt_read;
    135135uint32_t   exit_txt_read;
    136136
    137 uint32_t   enter_chdev_cmd;
    138 uint32_t   exit_chdev_cmd;
    139 
    140 uint32_t   enter_chdev_server;
    141 uint32_t   exit_chdev_server;
    142 
    143 uint32_t   enter_tty_cmd;
    144 uint32_t   exit_tty_cmd;
    145 
    146 uint32_t   enter_tty_isr;
    147 uint32_t   exit_tty_isr;
     137uint32_t   enter_chdev_cmd_read;
     138uint32_t   exit_chdev_cmd_read;
     139
     140uint32_t   enter_chdev_server_read;
     141uint32_t   exit_chdev_server_read;
     142
     143uint32_t   enter_tty_cmd_read;
     144uint32_t   exit_tty_cmd_read;
     145
     146uint32_t   enter_tty_isr_read;
     147uint32_t   exit_tty_isr_read;
     148#endif
     149
     150// these debug variables are used to analyse the sys_write() syscall timing
     151
     152#if CONFIG_WRITE_DEBUG   
     153uint32_t   enter_sys_write;
     154uint32_t   exit_sys_write;
     155
     156uint32_t   enter_devfs_write;
     157uint32_t   exit_devfs_write;
     158
     159uint32_t   enter_txt_write;
     160uint32_t   exit_txt_write;
     161
     162uint32_t   enter_chdev_cmd_write;
     163uint32_t   exit_chdev_cmd_write;
     164
     165uint32_t   enter_chdev_server_write;
     166uint32_t   exit_chdev_server_write;
     167
     168uint32_t   enter_tty_cmd_write;
     169uint32_t   exit_tty_cmd_write;
     170
     171uint32_t   enter_tty_isr_write;
     172uint32_t   exit_tty_isr_write;
    148173#endif
    149174
  • trunk/kernel/kern/process.c

    r433 r435  
    5151#include <elf.h>
    5252#include <syscalls.h>
    53 #include <signal.h>
     53#include <shared_syscalls.h>
    5454
    5555//////////////////////////////////////////////////////////////////////////////////////////
     
    114114    // get model process cluster and local pointer
    115115    model_cxy = GET_CXY( model_xp );
    116     model_ptr = (process_t *)GET_PTR( model_xp );
     116    model_ptr = GET_PTR( model_xp );
    117117
    118118    // get parent process cluster and local pointer
    119119    parent_cxy = GET_CXY( parent_xp );
    120     parent_ptr = (process_t *)GET_PTR( parent_xp );
     120    parent_ptr = GET_PTR( parent_xp );
    121121
    122122    // get model_pid and parent_pid
     
    209209        // get cluster and local pointer on chdev
    210210        chdev_cxy = GET_CXY( chdev_xp );
    211         chdev_ptr = (chdev_t *)GET_PTR( chdev_xp );
     211        chdev_ptr = GET_PTR( chdev_xp );
    212212 
    213213        // get TXT terminal index
     
    289289    // get reference process cluster and local pointer
    290290    cxy_t       ref_cxy = GET_CXY( reference_process_xp );
    291     process_t * ref_ptr = (process_t *)GET_PTR( reference_process_xp );
     291    process_t * ref_ptr = GET_PTR( reference_process_xp );
    292292
    293293    // initialize PID, REF_XP, PARENT_XP, and STATE
     
    364364    process_t * parent_ptr;
    365365    cxy_t       parent_cxy;
    366     xptr_t      parent_thread_xp;
    367366    xptr_t      children_lock_xp;
    368367    xptr_t      copies_lock_xp;
     
    450449}
    451450
    452 ////////////////////////////////////////////
    453 void process_sigaction( process_t * process,
     451////////////////////////////////////////
     452void process_sigaction( pid_t       pid,
    454453                        uint32_t    action_type )
    455454{
     
    467466    rpc_desc_t         rpc;               // rpc descriptor allocated in stack
    468467
     468    thread_t * client = CURRENT_THREAD;
     469
    469470#if CONFIG_DEBUG_PROCESS_SIGACTION
    470471uint32_t cycle = (uint32_t)hal_get_cycles();
    471472if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
    472 printk("\n[DBG] %s : thread %x enter to %s process %x in cluster %x / cycle %d\n",
    473 __FUNCTION__ , CURRENT_THREAD, process_action_str( action_type ) ,
    474 process->pid , local_cxy , cycle );
    475 #endif
    476 
    477     thread_t         * client = CURRENT_THREAD;
     473printk("\n[DBG] %s : thread %x enter to %s process %x / cycle %d\n",
     474__FUNCTION__ , client, process_action_str( action_type ) , pid , cycle );
     475#endif
    478476
    479477    // get local pointer on local cluster manager
     
    481479
    482480    // get owner cluster identifier and process lpid
    483     owner_cxy = CXY_FROM_PID( process->pid );
    484     lpid      = LPID_FROM_PID( process->pid );
    485 
    486     // check owner cluster
    487     assert( (owner_cxy == local_cxy) , __FUNCTION__ , "must be executed in owner cluster\n" );
    488    
    489     // get number of remote copies
    490     responses = cluster->pmgr.copies_nr[lpid] - 1;
     481    owner_cxy = CXY_FROM_PID( pid );
     482    lpid      = LPID_FROM_PID( pid );
     483
     484    // get root of list of copies, lock, and number of copies from owner cluster
     485    responses = hal_remote_lw ( XPTR( owner_cxy , &cluster->pmgr.copies_nr[lpid] ) );
     486    root_xp   = hal_remote_lwd( XPTR( owner_cxy , &cluster->pmgr.copies_root[lpid] ) );
     487    lock_xp   = hal_remote_lwd( XPTR( owner_cxy , &cluster->pmgr.copies_lock[lpid] ) );
     488
    491489    rsp_count = 0;
    492490
     
    502500    rpc.thread   = client;
    503501
    504     // get extended pointers on copies root and lock
    505     root_xp   = XPTR( local_cxy , &cluster->pmgr.copies_root[lpid] );
    506     lock_xp   = XPTR( local_cxy , &cluster->pmgr.copies_lock[lpid] );
    507 
    508502    // take the lock protecting the copies
    509503    remote_spinlock_lock( lock_xp );
     
    514508        process_xp  = XLIST_ELEMENT( iter_xp , process_t , copies_list );
    515509        process_cxy = GET_CXY( process_xp );
    516         process_ptr = (process_t *)GET_PTR( process_xp );
    517 
    518         // send RPC to remote clusters
    519         if( process_cxy != local_cxy ) 
    520         {
     510        process_ptr = GET_PTR( process_xp );
    521511
    522512#if CONFIG_DEBUG_PROCESS_SIGACTION
    523513if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
    524 printk("\n[DBG] %s : send RPC to remote cluster %x\n", __FUNCTION__ , process_cxy );
    525 #endif
    526 
    527             rpc.args[0] = (uint64_t)action_type;
    528             rpc.args[1] = (uint64_t)(intptr_t)process_ptr;
    529             rpc_process_sigaction_client( process_cxy , &rpc );
    530             rsp_count++;
    531         }
     514printk("\n[DBG] %s : send RPC to cluster %x\n", __FUNCTION__ , process_cxy );
     515#endif
     516
     517        // check PID
     518        assert( (hal_remote_lw( XPTR( process_cxy , &process_ptr->pid) ) == pid),
     519        __FUNCTION__ , "unconsistent PID value\n" );
     520
     521        rpc.args[0] = (uint64_t)action_type;
     522        rpc.args[1] = (uint64_t)pid;
     523        rpc_process_sigaction_client( process_cxy , &rpc );
     524        rsp_count++;
    532525    }
    533526   
     
    540533    rsp_count , responses );
    541534
    542     // block and deschedule to wait RPC responses if required
    543     if( responses )
    544     {   
    545         thread_block( CURRENT_THREAD , THREAD_BLOCKED_RPC );
    546         sched_yield("BLOCKED on RPC_PROCESS_SIGACTION");
    547     }
    548 
    549 #if CONFIG_DEBUG_PROCESS_SIGACTION
    550 if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
    551 printk("\n[DBG] %s : make action in owner cluster %x\n", __FUNCTION__ , local_cxy );
    552 #endif
    553 
    554     // call directly the relevant function in local owner cluster
    555     if      (action_type == DELETE_ALL_THREADS  ) process_delete_threads ( process );
    556     else if (action_type == BLOCK_ALL_THREADS   ) process_block_threads  ( process );
    557     else if (action_type == UNBLOCK_ALL_THREADS ) process_unblock_threads( process );
     535    // block and deschedule to wait RPC responses
     536    thread_block( CURRENT_THREAD , THREAD_BLOCKED_RPC );
     537    sched_yield("BLOCKED on RPC_PROCESS_SIGACTION");
    558538
    559539#if CONFIG_DEBUG_PROCESS_SIGACTION
     
    561541if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
    562542printk("\n[DBG] %s : thread %x exit after %s process %x in cluster %x / cycle %d\n",
    563 __FUNCTION__ , CURRENT_THREAD, process_action_str( action_type ) ,
     543__FUNCTION__ , client, process_action_str( action_type ) ,
    564544process->pid , local_cxy , cycle );
    565545#endif
     
    778758    {
    779759        process_xp  = XLIST_ELEMENT( iter , process_t , local_list );
    780         process_ptr = (process_t *)GET_PTR( process_xp );
     760        process_ptr = GET_PTR( process_xp );
    781761        if( process_ptr->pid == pid )
    782762        {
     
    838818
    839819    // get reference process cluster and local pointer
    840     process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );
     820    process_t * ref_ptr = GET_PTR( ref_xp );
    841821    cxy_t       ref_cxy = GET_CXY( ref_xp );
    842822
     
    858838    // get reference process cluster and local pointer
    859839    xptr_t ref_xp = process->ref_xp;
    860     process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );
     840    process_t * ref_ptr = GET_PTR( ref_xp );
    861841    cxy_t       ref_cxy = GET_CXY( ref_xp );
    862842
     
    900880        xptr_t      ref_xp  = process->ref_xp;
    901881        cxy_t       ref_cxy = GET_CXY( ref_xp );
    902         process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );
     882        process_t * ref_ptr = GET_PTR( ref_xp );
    903883
    904884        // access reference process descriptor
     
    925905    // get cluster and local pointer for src fd_array
    926906    cxy_t        src_cxy = GET_CXY( src_xp );
    927     fd_array_t * src_ptr = (fd_array_t *)GET_PTR( src_xp );
     907    fd_array_t * src_ptr = GET_PTR( src_xp );
    928908
    929909    // get cluster and local pointer for dst fd_array
    930910    cxy_t        dst_cxy = GET_CXY( dst_xp );
    931     fd_array_t * dst_ptr = (fd_array_t *)GET_PTR( dst_xp );
     911    fd_array_t * dst_ptr = GET_PTR( dst_xp );
    932912
    933913    // get the remote lock protecting the src fd_array
     
    10441024    // get cluster and local pointer for parent process
    10451025    cxy_t       parent_process_cxy = GET_CXY( parent_process_xp );
    1046     process_t * parent_process_ptr = (process_t *)GET_PTR( parent_process_xp );
     1026    process_t * parent_process_ptr = GET_PTR( parent_process_xp );
    10471027
    10481028    // get parent process PID and extended pointer on .elf file
     
    13491329}  // end process_make_exec()
    13501330
    1351 ////////////////////////////////////////////
    1352 void process_make_kill( process_t * process,
    1353                         bool_t      is_exit,
    1354                         uint32_t    exit_status )
    1355 {
    1356     thread_t * this = CURRENT_THREAD;
    1357 
    1358     assert( (CXY_FROM_PID( process->pid ) == local_cxy) , __FUNCTION__ ,
    1359     "must be executed in process owner cluster\n" );
    1360 
    1361     assert( ( this->type == THREAD_RPC ) , __FUNCTION__ ,
    1362     "must be executed by an RPC thread\n" );
    1363 
    1364 #if CONFIG_DEBUG_PROCESS_MAKE_KILL
    1365 uint32_t cycle = (uint32_t)hal_get_cycles();
    1366 if( CONFIG_DEBUG_PROCESS_MAKE_KILL < cycle )
    1367 printk("\n[DBG] %s : thread %x enter for process %x / cycle %d\n",
    1368 __FUNCTION__, this , process->pid , cycle );
    1369 #endif
    1370 
    1371     // register exit_status in owner process descriptor
    1372     if( is_exit ) process->term_state = exit_status;
    1373 
    1374     // atomically update owner process descriptor flags
    1375     if( is_exit ) hal_atomic_or( &process->term_state , PROCESS_FLAG_EXIT );
    1376     else          hal_atomic_or( &process->term_state , PROCESS_FLAG_KILL );
    1377 
    1378     // remove TXT ownership from owner process descriptor
    1379     process_txt_reset_ownership( XPTR( local_cxy , process ) );
    1380 
    1381     // block all process threads in all clusters
    1382     process_sigaction( process , BLOCK_ALL_THREADS );
    1383 
    1384     // mark all process threads in all clusters for delete
    1385     process_sigaction( process , DELETE_ALL_THREADS );
    1386 
    1387 /* unused if sys_wait deschedules without blocking [AG]
    1388 
    1389     // get cluster and pointers on reference parent process
    1390     xptr_t      parent_xp  = process->parent_xp;
    1391     process_t * parent_ptr = GET_PTR( parent_xp );
    1392     cxy_t       parent_cxy = GET_CXY( parent_xp );
    1393 
    1394     // get loal pointer on parent main thread
    1395     thread_t * main_ptr = hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->th_tbl[0] ) );
    1396  
    1397     // reset THREAD_BLOCKED_WAIT bit in parent process main thread
    1398     thread_unblock( XPTR( parent_cxy , main_ptr ) , THREAD_BLOCKED_WAIT );
    1399 */
    1400 
    1401 #if CONFIG_DEBUG_PROCESS_MAKE_KILL
    1402 cycle = (uint32_t)hal_get_cycles();
    1403 if( CONFIG_DEBUG_PROCESS_MAKE_KILL < cycle )
    1404 printk("\n[DBG] %s : thread %x exit for process %x / cycle %d\n",
    1405 __FUNCTION__, this, process->pid , cycle );
    1406 #endif
    1407 
    1408 }  // end process_make_kill()
    1409 
    14101331///////////////////////////////////////////////
    14111332void process_zero_create( process_t * process )
     
    16791600if( CONFIG_DEBUG_PROCESS_TXT_ATTACH < cycle )
    16801601printk("\n[DBG] %s : thread %x enter for process %x / txt_id = %d  / cycle %d\n",
    1681 __FUNCTION__, CURRENT_THREAD, process->pid, txt_id, cycle );
     1602__FUNCTION__, CURRENT_THREAD, process, txt_id, cycle );
    16821603#endif
    16831604
     
    17081629if( CONFIG_DEBUG_PROCESS_TXT_ATTACH < cycle )
    17091630printk("\n[DBG] %s : thread %x exit for process %x / txt_id = %d / cycle %d\n",
    1710 __FUNCTION__, CURRENT_THREAD, process->pid, txt_id , cycle );
     1631__FUNCTION__, CURRENT_THREAD, process, txt_id , cycle );
    17111632#endif
    17121633
     
    17211642    xptr_t      lock_xp;      // extended pointer on list lock in chdev
    17221643
    1723 #if CONFIG_DEBUG_PROCESS_TXT_DETACH
     1644#if CONFIG_DEBUG_PROCESS_TXT_ATTACH
    17241645uint32_t cycle = (uint32_t)hal_get_cycles();
    1725 if( CONFIG_DEBUG_PROCESS_TXT_DETACH < cycle )
     1646if( CONFIG_DEBUG_PROCESS_TXT_ATTACH < cycle )
    17261647printk("\n[DBG] %s : thread %x enter for process %x / cycle %d\n",
    1727 __FUNCTION__, CURRENT_THREAD, process->pid , cycle );
     1648__FUNCTION__, CURRENT_THREAD, process, cycle );
    17281649#endif
    17291650
     
    17451666    remote_spinlock_unlock( lock_xp );
    17461667   
    1747 #if CONFIG_DEBUG_PROCESS_TXT_DETACH
    1748 cycle = (uint32_t)hal_get_cycles();
    1749 if( CONFIG_DEBUG_PROCESS_TXT_DETACH < cycle )
     1668#if CONFIG_DEBUG_PROCESS_TXT_ATTACH
     1669cycle = (uint32_t)hal_get_cycles();
     1670if( CONFIG_DEBUG_PROCESS_TXT_ATTACH < cycle )
    17501671printk("\n[DBG] %s : thread %x exit for process %x / cycle %d\n",
    1751 __FUNCTION__, CURRENT_THREAD, process->pid, cycle );
     1672__FUNCTION__, CURRENT_THREAD, process, cycle );
    17521673#endif
    17531674
     
    17661687    // get cluster and local pointer on process
    17671688    process_cxy = GET_CXY( process_xp );
    1768     process_ptr = (process_t *)GET_PTR( process_xp );
     1689    process_ptr = GET_PTR( process_xp );
    17691690
    17701691    // get extended pointer on stdin pseudo file
     
    17741695    txt_xp  = chdev_from_file( file_xp );
    17751696    txt_cxy = GET_CXY( txt_xp );
    1776     txt_ptr = (chdev_t *)GET_PTR( txt_xp );
     1697    txt_ptr = GET_PTR( txt_xp );
    17771698
    17781699    // set owner field in TXT chdev
     
    18041725    // get cluster and local pointer on process
    18051726    process_cxy = GET_CXY( process_xp );
    1806     process_ptr = (process_t *)GET_PTR( process_xp );
     1727    process_ptr = GET_PTR( process_xp );
    18071728
    18081729    // get extended pointer on stdin pseudo file
     
    18311752            current_ptr = GET_PTR( current_xp );
    18321753            parent_xp   = hal_remote_lwd( XPTR( current_cxy , &current_ptr->parent_xp ) );
    1833 
    18341754            parent_cxy  = GET_CXY( parent_xp );
    18351755            parent_ptr  = GET_PTR( parent_xp );
    18361756            ppid        = hal_remote_lw( XPTR( parent_cxy , &parent_ptr->pid ) );
     1757
     1758printk("\n@@@ %s : pid = %x / process = %x\n", __FUNCTION__ , current_ptr->pid, current_ptr );
    18371759
    18381760            if( ppid == 1 )  // current is KSH
     
    18491771
    18501772
    1851      
     1773//////////////////////////////////////////////////////     
     1774inline pid_t process_get_txt_owner( uint32_t channel )
     1775{
     1776    xptr_t      txt_rx_xp  = chdev_dir.txt_rx[channel];
     1777    cxy_t       txt_rx_cxy = GET_CXY( txt_rx_xp );
     1778    chdev_t *   txt_rx_ptr = GET_PTR( txt_rx_xp );
     1779
     1780    xptr_t process_xp = (xptr_t)hal_remote_lwd( XPTR( txt_rx_cxy,
     1781                                                &txt_rx_ptr->ext.txt.owner_xp ) );
     1782
     1783    cxy_t       process_cxy = GET_CXY( process_xp );
     1784    process_t * process_ptr = GET_PTR( process_xp );
     1785
     1786    return (pid_t)hal_remote_lw( XPTR( process_cxy , &process_ptr->pid ) );
     1787}
     1788
     1789///////////////////////////////////////////
     1790void process_txt_display( uint32_t txt_id )
     1791{
     1792    xptr_t      chdev_xp;
     1793    cxy_t       chdev_cxy;
     1794    chdev_t   * chdev_ptr;
     1795    xptr_t      root_xp;
     1796    xptr_t      lock_xp;
     1797    xptr_t      current_xp;
     1798    xptr_t      iter_xp;
     1799
     1800    // check terminal index
     1801    assert( (txt_id < LOCAL_CLUSTER->nb_txt_channels) ,
     1802    __FUNCTION__ , "illegal TXT terminal index" );
     1803
     1804    // get pointers on TXT_RX[txt_id] chdev
     1805    chdev_xp  = chdev_dir.txt_rx[txt_id];
     1806    chdev_cxy = GET_CXY( chdev_xp );
     1807    chdev_ptr = GET_PTR( chdev_xp );
     1808
     1809    // get extended pointer on root & lock of attached process list
     1810    root_xp = XPTR( chdev_cxy , &chdev_ptr->ext.txt.root );
     1811    lock_xp = XPTR( chdev_cxy , &chdev_ptr->ext.txt.lock );
     1812
     1813    // display header
     1814    printk("\n***** processes attached to TXT_%d\n", txt_id );
     1815
     1816    // get lock
     1817    remote_spinlock_lock( lock_xp );
     1818
     1819    // scan attached process list to find KSH process
     1820    XLIST_FOREACH( root_xp , iter_xp )
     1821    {
     1822        current_xp  = XLIST_ELEMENT( iter_xp , process_t , txt_list );
     1823        process_display( current_xp );
     1824    }
     1825
     1826    // release lock
     1827    remote_spinlock_unlock( lock_xp );
     1828
     1829}  // end process_txt_display
  • trunk/kernel/kern/process.h

    r433 r435  
    3636#include <hal_atomic.h>
    3737#include <vmm.h>
    38 #include <signal.h>
    3938#include <cluster.h>
    4039#include <vfs.h>
     
    6362    DELETE_ALL_THREADS   = 33,
    6463};
    65 
    66 /*********************************************************************************************
    67  * The termination state is a 32 bits word:
    68  * - the 8 LSB bits contain the user defined exit status
    69  * - the 24 other bits contain the flags defined below
    70  ********************************************************************************************/
    71 
    72 #define PROCESS_FLAG_BLOCK 0x100  /*! process received as SIGSTOP signal                    */
    73 #define PROCESS_FLAG_KILL  0x200  /*! process terminated by a sys_kill()                    */
    74 #define PROCESS_FLAG_EXIT  0x400  /*! process terminated by a sys_exit()                    */
    75 #define PROCESS_FLAG_WAIT  0x800  /*! parent process executed successfully a sys_wait()     */
    7664
    7765/*********************************************************************************************
     
    291279
    292280/*********************************************************************************************
    293  * This function allows a client thread running in the owner cluster of a process identified
    294  * by the <process> argument to block, unblock or delete all threads of the target process,
    295  * depending on the <action_type> argument.  The scenario is the following:
     281 * This function allows a client thread running in any cluster to block, unblock or delete
     282 * all threads of a process identified by the <pid> argument, depending on the
     283 * <action_type> argument.  The scenario is the following:
    296284 * - It uses the multicast, non blocking rpc_process_sigaction_client() function to send
    297285 *   parallel requests to all remote clusters containing a process copy. Then it blocks
     
    305293 * It is used by the sys_kill() & sys_exit() functions to handle the "kill" & "exit" syscalls.
    306294 * It is also used by the process_make_exec() function to handle the "exec" syscall.
    307  * WARNING : the DELETE and the BLOCK actions are NOT executed on the client thread.
    308  *********************************************************************************************
    309  * @ process     : pointer on the process descriptor in owner cluster.
     295 * It is also called by the TXT device to execute the ctrl C & ctrl Z commands.
     296 * WARNING : the DELETE action is NOT executed on the main thread (thread 0 in owner cluster).
     297 *********************************************************************************************
     298 * @ pid         : target process identifier.
    310299 * @ action_type : BLOCK_ALL_THREADS / UNBLOCK_ALL_THREADS / DELETE_ALL_THREADS
    311300 ********************************************************************************************/
    312 void process_sigaction( process_t * process,
     301void process_sigaction( pid_t       pid,
    313302                        uint32_t    action_type );
    314303
     
    403392                            struct thread_s ** child_thread_ptr );
    404393
    405 /*********************************************************************************************
    406  * This function is called by both the sys_kill() and sys_exit() system calls.
    407  * It must be executed by an RPC thread running in the target process owner cluster.
    408  * It uses twice the process_sigaction() function:
    409  * - first, to block all target process threads, in all clusters.
    410  * - second, to delete all target process threads in all clusters.
    411  * Finally, it synchronizes with the parent process sys_wait() function that MUST be called
    412  * by the parent process main thread.
    413  *********************************************************************************************
    414  * @ process      : pointer on process descriptor in owner cluster.
    415  * @ is_exit      : true when called by sys_exit() / false when called by sys_kill().
    416  * @ exit_status  : exit status, when called by sys_exit().
    417  ********************************************************************************************/
    418 void process_make_kill( process_t * process,
    419                         bool_t      is_exit,
    420                         uint32_t    exit_status );
    421 
    422394
    423395/********************   File Management Operations   ****************************************/
     
    573545void process_txt_reset_ownership( xptr_t process_xp );
    574546
     547/*********************************************************************************************
     548 * This function returns the terminal owner process (foreground process)
     549 * for a given TXT terminal identified by its <channel> index.
     550 *********************************************************************************************
     551 * @ channel  : TXT terminal channel.
     552 * @ return owner process identifier.
     553 ********************************************************************************************/
     554pid_t process_get_txt_owner( uint32_t channel );
     555
     556/*********************************************************************************************
     557 * This debug function diplays on the kernel terminal the list of processes attached
     558 * to a given terminal identified by the <txt_id> argument.
     559 *********************************************************************************************
     560 * @ txt_id  : TXT terminal channel.
     561 ********************************************************************************************/
     562void process_txt_display( uint32_t txt_id );
     563
     564
    575565#endif  /* _PROCESS_H_ */
  • trunk/kernel/kern/rpc.c

    r433 r435  
    3939#include <vfs.h>
    4040#include <fatfs.h>
    41 #include <signal.h>
    4241#include <rpc.h>
    4342
     
    8079    &rpc_process_make_fork_server,      // 3
    8180    &rpc_undefined,                     // 4    unused slot
    82     &rpc_process_make_kill_server,      // 5
     81    &rpc_undefined,                     // 5    unused slot
    8382    &rpc_thread_user_create_server,     // 6
    8483    &rpc_thread_kernel_create_server,   // 7
     
    610609
    611610/////////////////////////////////////////////////////////////////////////////////////////
    612 // [5]      Marshaling functions attached to RPC_PROCESS_MAKE_KILL (blocking)
    613 /////////////////////////////////////////////////////////////////////////////////////////
    614 
    615 ///////////////////////////////////////////////////
    616 void rpc_process_make_kill_client( cxy_t       cxy,
    617                                    process_t * process,
    618                                    bool_t      is_exit,
    619                                    uint32_t    status )
    620 {
    621 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",
    622 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    623 CURRENT_THREAD->core->lid , hal_time_stamp() );
    624 
    625     // initialise RPC descriptor header
    626     rpc_desc_t  rpc;
    627     rpc.index    = RPC_PROCESS_MAKE_KILL;
    628     rpc.response = 1;
    629     rpc.blocking = true;
    630 
    631     // set input arguments in RPC descriptor 
    632     rpc.args[0] = (uint64_t)(intptr_t)process;
    633     rpc.args[1] = (uint64_t)is_exit;
    634     rpc.args[2] = (uint64_t)status;
    635 
    636     // register RPC request in remote RPC fifo (blocking function)
    637     rpc_send( cxy , &rpc );
    638 
    639 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",
    640 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    641 CURRENT_THREAD->core->lid , hal_time_stamp() );
    642 
    643 
    644 //////////////////////////////////////////////
    645 void rpc_process_make_kill_server( xptr_t xp )
    646 {
    647 rpc_dmsg("\n[DBG] %s : enter / thread %x on core[%x,%d] / cycle %d\n",
    648 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    649 CURRENT_THREAD->core->lid , hal_time_stamp() );
    650 
    651     process_t * process;
    652     bool_t      is_exit;
    653     uint32_t    status;
    654 
    655     // get client cluster identifier and pointer on RPC descriptor
    656     cxy_t        client_cxy  = (cxy_t)GET_CXY( xp );
    657     rpc_desc_t * desc        = (rpc_desc_t *)GET_PTR( xp );
    658 
    659     // get arguments from RPC descriptor
    660     process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
    661     is_exit = (bool_t)               hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
    662     status  = (uint32_t)             hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
    663 
    664     // call local kernel function
    665     process_make_kill( process , is_exit , status );
    666 
    667 rpc_dmsg("\n[DBG] %s : exit / thread %x on core[%x,%d] / cycle %d\n",
    668 __FUNCTION__ , CURRENT_THREAD->trdid , local_cxy,
    669 CURRENT_THREAD->core->lid , hal_time_stamp() );
    670 }
     611// [5]      undefined slot
     612/////////////////////////////////////////////////////////////////////////////////////////
    671613
    672614/////////////////////////////////////////////////////////////////////////////////////////
     
    906848                                   rpc_desc_t * rpc_ptr )
    907849{
    908 sigaction_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
     850rpc_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
    909851__FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) ,
    910852((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() );
     
    913855    rpc_send( cxy , rpc_ptr );
    914856
    915 sigaction_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n",
     857rpc_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x / cycle %d\n",
    916858__FUNCTION__ , process_action_str( (uint32_t)rpc_ptr->args[0] ) ,
    917859((process_t *)(intptr_t)rpc_ptr->args[1])->pid , cxy , (uint32_t)hal_get_cycles() );
     
    921863void rpc_process_sigaction_server( xptr_t xp )
    922864{
     865    pid_t        pid;              // target process identifier
    923866    process_t  * process;          // pointer on local process descriptor
    924867    uint32_t     action;           // sigaction index
     
    934877
    935878    // get arguments from RPC descriptor
    936     action      = (uint32_t)             hal_remote_lwd( XPTR( client_cxy , &rpc->args[0] ) );
    937     process     = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) );
     879    action      = (uint32_t)  hal_remote_lwd( XPTR( client_cxy , &rpc->args[0] ) );
     880    pid         = (pid_t)     hal_remote_lwd( XPTR( client_cxy , &rpc->args[1] ) );
    938881    client_ptr  = (thread_t *)hal_remote_lpt( XPTR( client_cxy , &rpc->thread ) );
     882
     883rpc_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n",
     884__FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() );
     885
     886    // get local process descriptor
     887    process = process_get_local_copy( pid );
    939888
    940889    // build extended pointer on client thread
    941890    client_xp = XPTR( client_cxy , client_ptr );
    942 
    943 sigaction_dmsg("\n[DBG] %s : enter to %s process %x / cycle %d\n",
    944 __FUNCTION__ , process_action_str( action ) , process->pid , (uint32_t)hal_get_cycles() );
    945891
    946892    // call relevant kernel function
     
    958904    }
    959905
    960 sigaction_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n",
    961 __FUNCTION__ , process_action_str( action ) , process->pid , (uint32_t)hal_get_cycles() );
     906rpc_dmsg("\n[DBG] %s : exit after %s process %x / cycle %d\n",
     907__FUNCTION__ , process_action_str( action ) , pid , (uint32_t)hal_get_cycles() );
    962908}
    963909
  • trunk/kernel/kern/rpc.h

    r433 r435  
    3232#include <vseg.h>
    3333#include <remote_fifo.h>
    34 #include <signal.h>
    3534
    3635/**** Forward declarations ****/
     
    6564    RPC_PROCESS_MAKE_FORK      = 3,
    6665    RPC_UNDEFINED_4            = 4,
    67     RPC_PROCESS_MAKE_KILL      = 5,
     66    RPC_UNDEFINED_5            = 5,
    6867    RPC_THREAD_USER_CREATE     = 6,
    6968    RPC_THREAD_KERNEL_CREATE   = 7,
     
    242241
    243242/***********************************************************************************
    244  * [5] The RPC_PROCESS_MAKE_KILL can be called by any thread to request the owner
    245  * cluster to execute the process_make_kill() function for a target process.
    246  ***********************************************************************************
    247  * @ cxy      : owner cluster identifier.
    248  * @ process  : pointer on process in owner cluster.
    249  * @ is_exit  : true if called by sys_exit() / false if called by sys_kill()
    250  * @ status   : exit status (only when called by sys_exit()
    251  **********************************************************************************/
    252 void rpc_process_make_kill_client( cxy_t              cxy,
    253                                    struct process_s * process,
    254                                    bool_t             is_exit,
    255                                    uint32_t           status );
    256 
    257 void rpc_process_make_kill_server( xptr_t xp );
     243 * [5] undefined slot
     244 **********************************************************************************/
    258245
    259246/***********************************************************************************
     
    314301/***********************************************************************************
    315302 * [9] The RPC_PROCESS_SIGACTION allows the owner cluster to request any other
    316  * cluster to execute a given sigaction (BLOCK / UNBLOCK / DELETE) for all threads
    317  * of a given process.
     303 * cluster to execute a given sigaction (BLOCK / UNBLOCK / DELETE) for all
     304 * threads of a given process.
    318305 *
    319306 * WARNING : It is implemented as a NON BLOCKING multicast RPC, that can be sent
  • trunk/kernel/kern/scheduler.c

    r433 r435  
    280280    }
    281281
    282     // enter critical section / save SR in current thread context
    283     hal_disable_irq( &current->save_sr );
     282    // enter critical section / save SR in current thread descriptor
     283    hal_disable_irq( &CURRENT_THREAD->save_sr );
    284284
    285285    // loop on threads to select next thread
     
    321321        }
    322322
    323         // switch CPU from calling thread context to new thread context
     323        // switch CPU from current thread context to new thread context
    324324        hal_do_cpu_switch( current->cpu_context, next->cpu_context );
    325325    }
     
    330330uint32_t cycle = (uint32_t)hal_get_cycles();
    331331if( CONFIG_DEBUG_SCHED_YIELD < cycle )
    332 printk("\n[DBG] %s : core[%x,%d] / cause = %s / thread %x (%s) (%x,%x) continue / cycle %d\n",
     332printk("\n[DBG] %s : core[%x,%d] / cause = %s\n"
     333"      thread %x (%s) (%x,%x) continue / cycle %d\n",
    333334__FUNCTION__, local_cxy, core->lid, cause,
    334335current, thread_type_str(current->type), current->process->pid, current->trdid, cycle );
     
    340341    sched_handle_signals( core );
    341342
    342     // exit critical section / restore SR from next thread context
    343     hal_restore_irq( next->save_sr );
     343    // exit critical section / restore SR from current thread descriptor
     344    hal_restore_irq( CURRENT_THREAD->save_sr );
    344345
    345346}  // end sched_yield()
  • trunk/kernel/kern/signal.h

    r409 r435  
    2828
    2929#include <hal_types.h>
    30 
    31 #define SIG_DEFAULT    (void*)0L
    32 #define SIG_IGNORE     (void*)1L
    33 #define SIG_ERROR     -1L
    34 
    35 #define SIGHUP     1       /*! hangup                                                     */
    36 #define SIGINT     2       /*! interrupt                                                  */
    37 #define SIGQUIT    3       /*! quit                                                       */
    38 #define SIGILL     4       /*! illegal instruction (not reset when caught)                */
    39 #define SIGTRAP    5       /*! trace trap (not reset when caught)                         */
    40 #define SIGIOT     6       /*! IOT instruction                                            */
    41 #define SIGABRT    6       /*! used by abort, replace SIGIOT in the future                */
    42 #define SIGEMT     7       /*! EMT instruction                                            */
    43 #define SIGFPE     8       /*! floating point exception                                   */
    44 #define SIGKILL    9       /*! kill (cannot be caught or ignored)                         */
    45 #define SIGBUS     10      /*! bus error                                                  */
    46 #define SIGSEGV    11      /*! segmentation violation                                     */
    47 #define SIGSYS     12      /*! bad argument to system call                                */
    48 #define SIGPIPE    13      /*! write on a pipe with no one to read it                     */
    49 #define SIGALRM    14      /*! alarm clock                                                */
    50 #define SIGTERM    15      /*! software termination signal from kill                      */
    51 #define SIGURG     16      /*! urgent condition on IO channel                             */
    52 #define SIGSTOP    17      /*! sendable stop signal not from tty                          */
    53 #define SIGTSTP    18      /*! stop signal from tty                                       */
    54 #define SIGCONT    19      /*! continue a stopped process                                 */
    55 #define SIGCHLD    20      /*! to parent on child stop or exit                            */
    56 #define SIGCLD     20      /*! System V name for SIGCHLD                                  */
    57 #define SIGTTIN    21      /*! to readers pgrp upon background tty read                   */
    58 #define SIGTTOU    22      /*! like TTIN for output if (tp->t_local&LTOSTOP)              */
    59 #define SIGIO      23      /*! input/output possible signal                               */
    60 #define SIGPOLL    SIGIO   /*! System V name for SIGIO                                    */
    61 #define SIGXCPU    24      /*! exceeded CPU time limit                                    */
    62 #define SIGXFSZ    25      /*! exceeded file size limit                                   */
    63 #define SIGVTALRM  26      /*! virtual time alarm                                         */
    64 #define SIGPROF    27      /*! profiling time alarm                                       */
    65 #define SIGWINCH   28      /*! window changed                                             */
    66 #define SIGLOST    29      /*! resource lost (eg, record-lock lost)                       */
    67 #define SIGUSR1    30      /*! user defined signal 1                                      */
    68 #define SIGUSR2    31      /*! user defined signal 2                                      */
    69 #define SIG_NR     32      /*! signal 0 implied                                           */
    70 
    71 #define SIG_DEFAULT_MASK         0xFFEEFFFF
    7230
    7331
  • trunk/kernel/libk/xlist.h

    r24 r435  
    7272 * extended double linked list, identified by the extended pointer on
    7373 * the root xlist_entry_t.
     74 * WARNING : check list non empty before using this macro.
    7475 * @ root_xp : extended pointer on the root xlist_entry_t
    7576 * @ type    : type of the linked elements
     
    8586 * extended double linked list, identified by the extended pointer on
    8687 * the root xlist_entry_t.
     88 * WARNING : check list non empty before using this macro.
    8789 * @ root_xp : extended pointer on the root xlist_entry_t
    8890 * @ type    : type of the linked elements
  • trunk/kernel/mm/kcm.c

    r433 r435  
    4848{
    4949
    50 #if CONFIG_DEBUG_KCM_ALLOC
     50#if CONFIG_DEBUG_KCM
    5151uint32_t cycle = (uint32_t)hal_get_cycles();
    52 if( CONFIG_DEBUG_KCM_ALLOC < cycle )
     52if( CONFIG_DEBUG_KCM < cycle )
    5353printk("\n[DBG] %s : thread %x enters for %s / page %x / count %d / active %d\n",
    5454__FUNCTION__ , CURRENT_THREAD , kmem_type_str( kcm->type ) ,
     
    8585                     + (index * kcm->block_size) );
    8686
    87 #if CONFIG_DEBUG_KCM_ALLOC
     87#if CONFIG_DEBUG_KCM
    8888cycle = (uint32_t)hal_get_cycles();
    89 if( CONFIG_DEBUG_KCM_ALLOC < cycle )
     89if( CONFIG_DEBUG_KCM < cycle )
    9090printk("\n[DBG] %s : thread %x exit / type  %s / ptr %p / page %x / count %d\n",
    9191__FUNCTION__ , CURRENT_THREAD , kmem_type_str( kcm->type ) , ptr ,
  • trunk/kernel/mm/kmem.c

    r433 r435  
    145145        assert( ((type > 1) && (type < KMEM_TYPES_NR) ) , __FUNCTION__ , "illegal KCM type" );
    146146
    147         kmem_dmsg("\n[DBG] %s : enters / KCM type %s missing in cluster %x\n",
    148                   __FUNCTION__ , kmem_type_str( type ) , local_cxy );
     147#if CONFIG_DEBUG_KMEM
     148uint32_t cycle = (uint32_t)hal_get_cycles();
     149if( CONFIG_DEBUG_KMEM < cycle )
     150printk("\n[DBG] %s : thread %x enter / KCM type %s missing in cluster %x / cycle %d\n",
     151__FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), local_cxy, cycle );
     152#endif
    149153
    150154        cluster_t * cluster = LOCAL_CLUSTER;
     
    169173        hal_fence();
    170174
    171         kmem_dmsg("\n[DBG] %s : exit / KCM type %s created in cluster %x\n",
    172                   __FUNCTION__ , kmem_type_str( type ) , local_cxy );
     175#if CONFIG_DEBUG_KMEM
     176cycle = (uint32_t)hal_get_cycles();
     177if( CONFIG_DEBUG_KMEM < cycle )
     178printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     179__FUNCTION__, CURRENT_THREAD, cycle );
     180#endif
    173181
    174182        return 0;
     
    192200        assert( (type < KMEM_TYPES_NR) , __FUNCTION__ , "illegal KMEM request type" );
    193201
    194         kmem_dmsg("\n[DBG] %s : enters in cluster %x for type %s\n",
    195                       __FUNCTION__ , local_cxy , kmem_type_str( type ) );
     202#if CONFIG_DEBUG_KMEM
     203uint32_t cycle = (uint32_t)hal_get_cycles();
     204if( CONFIG_DEBUG_KMEM < cycle )
     205printk("\n[DBG] %s : thread %x enter / type %s / cluster %x / cycle %d\n",
     206__FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), local_cxy, cycle );
     207#endif
    196208
    197209        // analyse request type
    198210        if( type == KMEM_PAGE )                        // PPM allocator
    199211        {
    200 
    201 #if CONFIG_DEBUG_KMEM_ALLOC
    202 if( CONFIG_DEBUG_KMEM_ALLOC < (uint32_t)hal_get_cycles() )
    203 printk("\n[DBG] in %s : thread %x enter for %d page(s)\n",
    204 __FUNCTION__ , CURRENT_THREAD , 1<<size );
    205 #endif
    206 
    207212                // allocate the number of requested pages
    208213                ptr = (void *)ppm_alloc_pages( size );
     
    217222                if( flags & AF_ZERO ) page_zero( (page_t *)ptr );
    218223
    219                 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / page = %x / base = %x\n",
    220                           __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    221                           (intptr_t)ptr , (intptr_t)ppm_page2base( ptr ) );
    222 
    223 #if CONFIG_DEBUG_KMEM_ALLOC
    224 if( CONFIG_DEBUG_KMEM_ALLOC < (uint32_t)hal_get_cycles() )
    225 printk("\n[DBG] in %s : thread %x exit / %d page(s) allocated / ppn = %x\n",
    226 __FUNCTION__ , CURRENT_THREAD , 1<<size , ppm_page2ppn( XPTR( local_cxy , ptr ) ) );
     224#if CONFIG_DEBUG_KMEM
     225cycle = (uint32_t)hal_get_cycles();
     226if( CONFIG_DEBUG_KMEM < cycle )
     227printk("\n[DBG] %s : thread %x exit / %d page(s) allocated / ppn %x / cycle %d\n",
     228__FUNCTION__, CURRENT_THREAD, 1<<size, ppm_page2ppn(XPTR(local_cxy,ptr)), cycle );
    227229#endif
    228230
     
    242244                if( flags & AF_ZERO ) memset( ptr , 0 , size );
    243245
    244                 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / base = %x / size = %d\n",
    245                           __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    246                           (intptr_t)ptr , req->size );
     246#if CONFIG_DEBUG_KMEM
     247cycle = (uint32_t)hal_get_cycles();
     248if( CONFIG_DEBUG_KMEM < cycle )
     249printk("\n[DBG] %s : thread %x exit / type %s allocated / base %x / size %d / cycle %d\n",
     250__FUNCTION__, CURRENT_THREAD, kmem_type_str( type ), (intptr_t)ptr, size, cycle );
     251#endif
     252
    247253        }
    248254        else                                           // KCM allocator
     
    269275                if( flags & AF_ZERO ) memset( ptr , 0 , kmem_type_size( type ) );
    270276
    271                 kmem_dmsg("\n[DBG] %s : exit in cluster %x for type %s / base = %x / size = %d\n",
    272                           __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    273                           (intptr_t)ptr , kmem_type_size( type ) );
     277#if CONFIG_DEBUG_KMEM
     278cycle = (uint32_t)hal_get_cycles();
     279if( CONFIG_DEBUG_KMEM < cycle )
     280printk("\n[DBG] %s : thread %x exit / type %s allocated / base %x / size %d / cycle %d\n",
     281__FUNCTION__, CURRENT_THREAD, kmem_type_str(type), (intptr_t)ptr,
     282kmem_type_size(type), cycle );
     283#endif
     284
    274285        }
    275286
  • trunk/kernel/mm/mapper.c

    r408 r435  
    143143    error_t       error;
    144144
    145 mapper_dmsg("\n[DBG] %s : core[%x,%d] enters for page %d / mapper %x\n",
    146 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , mapper );
     145#if CONFIG_DEBUG_MAPPER_GET_PAGE
     146uint32_t cycle = (uint32_t)hal_get_cycles();
     147if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle )
     148printk("\n[DBG] %s : thread %x enter for page %d / mapper %x / cycle %d\n",
     149__FUNCTION__ , CURRENT_THREAD , index , mapper , cycle );
     150#endif
    147151
    148152    thread_t * this = CURRENT_THREAD;
     
    171175        {
    172176
    173 mapper_dmsg("\n[DBG] %s : core[%x,%d] missing page => load from device\n",
    174 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );
    175 
     177#if (CONFIG_DEBUG_MAPPER_GET_PAGE & 1)
     178if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle )
     179printk("\n[DBG] %s : missing page => load from device\n", __FUNCTION__ );
     180#endif
    176181            // allocate one page from PPM
    177182            req.type  = KMEM_PAGE;
     
    230235            // reset the page INLOAD flag to make the page available to all readers
    231236            page_clear_flag( page , PG_INLOAD );
    232 
    233 mapper_dmsg("\n[DBG] %s : missing page loaded / ppn = %x\n",
    234 __FUNCTION__ , ppm_page2ppn(XPTR(local_cxy,page)) );
    235 
    236237        }
    237238        else if( page_is_flag( page , PG_INLOAD ) )   // page is loaded by another thread
     
    256257    }
    257258
    258 mapper_dmsg("\n[DBG] %s : exit for page %d / mapper %x / page_desc = %x\n",
    259 __FUNCTION__ , index , mapper , page );
     259#if CONFIG_DEBUG_MAPPER_GET_PAGE
     260cycle = (uint32_t)hal_get_cycles();
     261if( CONFIG_DEBUG_MAPPER_GET_PAGE < cycle )
     262printk("\n[DBG] %s : thread %x exit for page %d / ppn %x / cycle %d\n",
     263__FUNCTION__, CURRENT_THREAD, index, ppm_page2ppn(XPTR(local_cxy, page)), cycle );
     264#endif
    260265
    261266    return page;
     
    312317    uint8_t  * buf_ptr;        // current buffer  address
    313318
    314     mapper_dmsg("\n[DBG] %s : enters / to_buf = %d / buffer = %x\n",
    315                 __FUNCTION__ , to_buffer , buffer );
     319#if CONFIG_DEBUG_MAPPER_MOVE_USER
     320uint32_t cycle = (uint32_t)hal_get_cycles();
     321if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle )
     322printk("\n[DBG] %s : thread %x enter / to_buf %d / buffer %x / cycle %d\n",
     323__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer , cycle );
     324#endif
    316325
    317326    // compute offsets of first and last bytes in file
     
    338347        else                       page_count = CONFIG_PPM_PAGE_SIZE;
    339348
    340         mapper_dmsg("\n[DBG] %s : index = %d / offset = %d / count = %d\n",
    341                     __FUNCTION__ , index , page_offset , page_count );
     349#if (CONFIG_DEBUG_MAPPER_MOVE_USER & 1)
     350if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle )
     351printk("\n[DBG] %s : index = %d / offset = %d / count = %d\n",
     352__FUNCTION__ , index , page_offset , page_count );
     353#endif
    342354
    343355        // get page descriptor
     
    353365        buf_ptr = (uint8_t *)buffer + done;
    354366
    355         mapper_dmsg("\n[DBG] %s : index = %d / buf_ptr = %x / map_ptr = %x\n",
    356                     __FUNCTION__ , index , buf_ptr , map_ptr );
    357 
    358367        // move fragment
    359368        if( to_buffer )
     
    370379    }
    371380
    372     mapper_dmsg("\n[DBG] %s : exit for buffer %x\n",
    373                 __FUNCTION__, buffer );
     381#if CONFIG_DEBUG_MAPPER_MOVE_USER
     382cycle = (uint32_t)hal_get_cycles();
     383if( CONFIG_DEBUG_MAPPER_MOVE_USER < cycle )
     384printk("\n[DBG] %s : thread %x exit / to_buf %d / buffer %x / cycle %d\n",
     385__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer , cycle );
     386#endif
    374387
    375388    return 0;
     
    399412    uint8_t * buffer_ptr = (uint8_t *)GET_PTR( buffer_xp );
    400413
    401 mapper_dmsg("\n[DBG] %s : core[%x,%d] / to_buf = %d / buf_cxy = %x / buf_ptr = %x / size = %x\n",
    402 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, to_buffer, buffer_cxy, buffer_ptr, size );
     414#if CONFIG_DEBUG_MAPPER_MOVE_KERNEL
     415uint32_t cycle = (uint32_t)hal_get_cycles();
     416if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     417printk("\n[DBG] %s : thread %x enter / to_buf %d / buf_cxy %x / buf_ptr %x / cycle %d\n",
     418__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer_cxy , buffer_ptr , cycle );
     419#endif
    403420
    404421    // compute offsets of first and last bytes in file
     
    410427    uint32_t last  = max_byte >> CONFIG_PPM_PAGE_SHIFT;
    411428
    412 mapper_dmsg("\n[DBG] %s : core[%x,%d] / first_page = %d / last_page = %d\n",
    413 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, first, last );
     429#if (CONFIG_DEBUG_MAPPER_MOVE_KERNEL & 1)
     430if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     431printk("\n[DBG] %s : first_page %d / last_page %d\n", __FUNCTION__, first, last );
     432#endif
    414433
    415434    // compute source and destination clusters
     
    440459        else                       page_count = CONFIG_PPM_PAGE_SIZE;
    441460
    442 mapper_dmsg("\n[DBG] %s : core[%x;%d] / page_index = %d / offset = %d / bytes = %d\n",
    443 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, index, page_offset, page_count );
     461#if (CONFIG_DEBUG_MAPPER_MOVE_KERNEL & 1)
     462if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     463printk("\n[DBG] %s : page_index = %d / offset = %d / bytes = %d\n",
     464__FUNCTION__ , index , page_offset , page_count );
     465#endif
    444466
    445467        // get page descriptor
     
    472494    }
    473495
    474 mapper_dmsg("\n[DBG] %s : core_cxy[%x,%d] / exit / buf_cxy = %x / buf_ptr = %x / size = %x\n",
    475 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, buffer_cxy, buffer_ptr, size );
     496#if CONFIG_DEBUG_MAPPER_MOVE_KERNEL
     497cycle = (uint32_t)hal_get_cycles();
     498if( CONFIG_DEBUG_MAPPER_MOVE_KERNEL < cycle )
     499printk("\n[DBG] %s : thread %x exit / to_buf %d / buf_cxy %x / buf_ptr %x / cycle %d\n",
     500__FUNCTION__ , CURRENT_THREAD , to_buffer , buffer_cxy , buffer_ptr , cycle );
     501#endif
    476502
    477503    return 0;
  • trunk/kernel/mm/vmm.c

    r433 r435  
    16431643#if CONFIG_DEBUG_VMM_GET_PTE
    16441644uint32_t cycle = (uint32_t)hal_get_cycles();
    1645 if( CONFIG_DEBUG_VMM_GET_PTE > cycle )
     1645if( CONFIG_DEBUG_VMM_GET_PTE < cycle )
    16461646printk("\n[DBG] %s : thread %x enter for vpn = %x / process %x / cow = %d / cycle %d\n",
    16471647__FUNCTION__ , CURRENT_THREAD , vpn , process->pid , cow , cycle );
     
    18001800    error_t          error;
    18011801
     1802#if CONFIG_DEBUG_VMM_GET_PTE
     1803uint32_t cycle = (uint32_t)hal_get_cycles();
     1804if( CONFIG_DEBUG_VMM_GET_PTE < cycle )
     1805printk("\n[DBG] %s : thread %x enter for vpn %x / process %x / cycle %d\n",
     1806__FUNCTION__ , CURRENT_THREAD , vpn , process->pid , cycle );
     1807#endif
     1808
    18021809    // get reference process cluster and local pointer
    18031810    cxy_t       ref_cxy = GET_CXY( process->ref_xp );
     
    18331840    }
    18341841
     1842#if CONFIG_DEBUG_VMM_GET_PTE
     1843cycle = (uint32_t)hal_get_cycles();
     1844if( CONFIG_DEBUG_VMM_GET_PTE < cycle )
     1845printk("\n[DBG] %s : thread %x exit for vpn %x / process %x / cycle %d\n",
     1846__FUNCTION__ , CURRENT_THREAD , vpn , process->pid , cycle );
     1847#endif
     1848
    18351849    return error;
    18361850
     
    18451859    error_t          error;
    18461860
     1861#if CONFIG_DEBUG_VMM_GET_PTE
     1862uint32_t cycle = (uint32_t)hal_get_cycles();
     1863if( CONFIG_DEBUG_VMM_GET_PTE < cycle )
     1864printk("\n[DBG] %s : thread %x enter for vpn %x / process %x / cycle %d\n",
     1865__FUNCTION__ , CURRENT_THREAD , vpn , process->pid , cycle );
     1866#endif
    18471867   
    18481868    // get reference process cluster and local pointer
     
    18791899    }
    18801900
     1901#if CONFIG_DEBUG_VMM_GET_PTE
     1902cycle = (uint32_t)hal_get_cycles();
     1903if( CONFIG_DEBUG_VMM_GET_PTE < cycle )
     1904printk("\n[DBG] %s : thread %x exit for vpn %x / process %x / cycle %d\n",
     1905__FUNCTION__ , CURRENT_THREAD , vpn , process->pid , cycle );
     1906#endif
     1907
    18811908    return error;
    18821909
  • trunk/kernel/syscalls/shared_syscalls.h

    r421 r435  
    321321typedef enum
    322322{
    323     DISPLAY_STRING  = 0,
    324     DISPLAY_VMM     = 1,
    325     DISPLAY_SCHED   = 2,
    326     DISPLAY_PROCESS = 3,
    327     DISPLAY_VFS     = 4,
    328     DISPLAY_CHDEV   = 5,
     323    DISPLAY_STRING            = 0,
     324    DISPLAY_VMM               = 1,
     325    DISPLAY_SCHED             = 2,
     326    DISPLAY_CLUSTER_PROCESSES = 3,
     327    DISPLAY_VFS               = 4,
     328    DISPLAY_CHDEV             = 5,
     329    DISPLAY_TXT_PROCESSES     = 6,
    329330}
    330331display_type_t;
     
    391392
    392393
     394/*********************************************************************************************
     395 * These macros can be used by the parent process to analyze a child process
     396 * termination status, as returned by the wait() syscall.
     397 * The termination state is a 32 bits word:
     398 * - the 8 LSB bits contain the user defined exit status
     399 * - the 24 other bits contain the flags defined below
     400 ********************************************************************************************/
     401
     402#define PROCESS_TERM_STOP  0x100            /*! process received a SIGSTOP signal           */
     403#define PROCESS_TERM_KILL  0x200            /*! process killed by a SIGKILL signal          */
     404#define PROCESS_TERM_EXIT  0x400            /*! process terminated by a sys_exit()          */
     405#define PROCESS_TERM_WAIT  0x800            /*! parent process executed a sys_wait()        */
     406
     407#define WIFEXITED( status )       (status & PROCESS_TERM_EXIT)
     408#define WIFSIGNALED( status )     (status & PROCESS_TERM_KILL)
     409#define WIFSTOPPED( status )      (status & PROCESS_TERM_STOP)
     410#define WEXITSTATUS( status )     (status & 0xFF)
     411
    393412
    394413#endif  // _SHARED_SYSCALLS_H_
  • trunk/kernel/syscalls/sys_display.c

    r433 r435  
    142142        }
    143143    }
    144     else if( type == DISPLAY_PROCESS )
     144    else if( type == DISPLAY_CLUSTER_PROCESSES )
    145145    {
    146146        cxy_t cxy = (cxy_t)arg0;
     
    155155
    156156        cluster_processes_display( cxy );
     157    }
     158    else if( type == DISPLAY_TXT_PROCESSES )
     159    {
     160        uint32_t txt_id = (uint32_t)arg0;
     161
     162        // check argument
     163            if( txt_id >= LOCAL_CLUSTER->nb_txt_channels )
     164        {
     165            printk("\n[ERROR] in %s : undefined TXT channel %x\n",
     166            __FUNCTION__ , txt_id );
     167            return -1;
     168        }
     169
     170        process_txt_display( txt_id );
    157171    }
    158172    else if( type == DISPLAY_VFS )
  • trunk/kernel/syscalls/sys_exec.c

    r433 r435  
    221221printk("\n[ERROR] in %s : cannot access args\n", __FUNCTION__ );
    222222#endif
    223             this->errno = error;
     223            this->errno = EINVAL;
    224224            return -1;
    225225        }
     
    235235printk("\n[ERROR] in %s : cannot access envs\n", __FUNCTION__ );
    236236#endif
    237             this->errno = error;
     237            this->errno = EINVAL;
    238238            return -1;
    239239        }
     
    248248#if CONFIG_DEBUG_SYSCALLS_ERROR
    249249printk("\n[ERROR] in %s : cannot create process %x in cluster %x\n",
    250 __FUNCTION__, pid, CXY_FROM_PID( pid );
     250__FUNCTION__, pid, CXY_FROM_PID(pid) );
    251251#endif
    252252        this->errno = error;
  • trunk/kernel/syscalls/sys_exit.c

    r433 r435  
    2929#include <printk.h>
    3030#include <process.h>
    31 #include <signal.h>
     31#include <shared_syscalls.h>
    3232#include <cluster.h>
    3333#include <rpc.h>
     
    5151#endif
    5252
    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 );
     53    // get owner cluster
     54    cxy_t  owner_cxy = CXY_FROM_PID( pid );
    5755
    58     assert( (owner_xp != XPTR_NULL) , __FUNCTION__ , "owner_xp cannot be NULL\n" );
     56    // exit must be called by the main thread
     57    if( (owner_cxy != local_cxy) || (LTID_FROM_TRDID( this->trdid ) != 0) )
     58    {
     59
     60#if CONFIG_DEBUG_SYSCALLS_ERROR
     61printk("\n[ERROR] %s must be called by thread 0 in process owner cluster\n"
     62       "         trdid = %x / pid = %x / local_cxy = %x\n",
     63__FUNCTION__, this->trdid, pid, local_cxy );
     64#endif
     65         this->errno = EINVAL;
     66         return -1;
     67    }
    5968
    6069    // enable IRQs
    6170    hal_enable_irq( &save_sr );
    6271
    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 );
     72    // register exit_status in owner process descriptor
     73    process->term_state = status;
     74
     75    // remove TXT ownership from owner process descriptor
     76    process_txt_reset_ownership( XPTR( local_cxy , process ) );
     77
     78    // block all process threads in all clusters
     79    process_sigaction( pid , BLOCK_ALL_THREADS );
     80
     81    // mark all process threads in all clusters for delete
     82    process_sigaction( pid , DELETE_ALL_THREADS );
    6683
    6784    // restore IRQs
    6885    hal_restore_irq( save_sr );
    6986
     87    // atomically update owner process descriptor term_state
     88    hal_remote_atomic_or( XPTR( local_cxy , &process->term_state ) ,
     89                          PROCESS_TERM_EXIT );
    7090    hal_fence();
    7191
  • trunk/kernel/syscalls/sys_fork.c

    r433 r435  
    8181    if( hal_remote_atomic_add( children_xp , 1 ) >= CONFIG_PROCESS_MAX_CHILDREN )
    8282        {
    83             printk("\n[ERROR] in %s : too much children processes\n", __FUNCTION__);
     83
     84#if CONFIG_DEBUG_SYSCALLS_ERROR
     85printk("\n[ERROR] in %s : too much children processes\n", __FUNCTION__);
     86#endif
    8487            hal_remote_atomic_add ( children_xp , -1 );
    8588        parent_thread_ptr->errno = EAGAIN;
     
    119122    if( error )
    120123    {
    121         printk("\n[ERROR] in %s : cannot fork process %x in cluster %x\n",
    122         __FUNCTION__, parent_pid, local_cxy );
     124
     125#if CONFIG_DEBUG_SYSCALLS_ERROR
     126printk("\n[ERROR] in %s : cannot fork process %x in cluster %x\n",
     127__FUNCTION__, parent_pid, local_cxy );
     128#endif
    123129        parent_thread_ptr->errno = EAGAIN;
    124130        return -1;
  • trunk/kernel/syscalls/sys_get_config.c

    r421 r435  
    3535int sys_get_config( uint32_t * x_size,
    3636                    uint32_t * y_size,
    37                     uint32_t * y_width,
    3837                    uint32_t * ncores )
    3938{
     
    4140    uint32_t  k_x_size;
    4241    uint32_t  k_y_size;
    43     uint32_t  k_y_width;
    4442    uint32_t  k_ncores;
    4543
     
    4947    process_t * process = this->process;
    5048
     49#if CONFIG_DEBUG_SYS_GET_CONFIG
     50uint64_t     tm_start;
     51uint64_t     tm_end;
     52tm_start = hal_get_cycles();
     53if( CONFIG_DEBUG_SYS_GET_CONFIG < tm_start )
     54printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
     55__FUNCTION__, this, process->pid, (uint32_t)tm_start );
     56#endif
     57
    5158    // check buffer in user space
    5259    error |= vmm_v2p_translate( false , x_size  , &paddr );
    5360    error |= vmm_v2p_translate( false , y_size  , &paddr );
    54     error |= vmm_v2p_translate( false , y_width , &paddr );
    5561    error |= vmm_v2p_translate( false , ncores  , &paddr );
    5662
    5763        if( error )
    5864        {
    59         printk("\n[ERROR] in %s : user buffer unmapped for thread %x in process %x\n",
    60                __FUNCTION__ , this->trdid , process->pid );
     65
     66#if CONFIG_DEBUG_SYSCALLS_ERROR
     67printk("\n[ERROR] in %s : user buffer unmapped for thread %x in process %x\n",
     68__FUNCTION__ , this->trdid , process->pid );
     69#endif
    6170        this->errno = EFAULT;
    6271                return -1;
     
    6675        k_x_size  = LOCAL_CLUSTER->x_size;
    6776        k_y_size  = LOCAL_CLUSTER->y_size;
    68         k_y_width = LOCAL_CLUSTER->y_width;
    6977        k_ncores  = LOCAL_CLUSTER->cores_nr;
    7078
     
    7280        hal_copy_to_uspace( x_size  , &k_x_size  , sizeof(uint32_t) );
    7381        hal_copy_to_uspace( y_size  , &k_y_size  , sizeof(uint32_t) );
    74         hal_copy_to_uspace( y_width , &k_y_width , sizeof(uint32_t) );
    7582        hal_copy_to_uspace( ncores  , &k_ncores  , sizeof(uint32_t) );
     83
     84    hal_fence();
     85
     86#if CONFIG_DEBUG_SYS_GET_CONFIG
     87tm_end = hal_get_cycles();
     88if( CONFIG_DEBUG_SYS_GET_CONFIG < tm_end )
     89printk("\n[DBG] %s : thread %x exit / process %x / cost %d / tycle %d\n",
     90__FUNCTION__, this, process->pid, (uint32_t)(tm_end-tm_start), (uint32_t)tm_end );
     91#endif
    7692
    7793        return 0;
  • trunk/kernel/syscalls/sys_kill.c

    r433 r435  
    4848
    4949    thread_t  * this    = CURRENT_THREAD;
     50    process_t * process = this->process;
    5051
    5152#if CONFIG_DEBUG_SYS_KILL
     
    5859#endif
    5960
    60     // get cluster and pointers on owner process
     61    // process cannot kill itself
     62    if( pid == process->pid )
     63    {
     64
     65#if CONFIG_DEBUG_SYSCALLS_ERROR
     66printk("\n[ERROR] in %s : process %d cannot kill itself\n", __FUNCTION__ , pid );
     67#endif
     68        this->errno = EINVAL;
     69        return -1;
     70    }
     71
     72    // get cluster and pointers on owner target process descriptor
    6173    owner_xp  = cluster_get_owner_process_from_pid( pid );
    6274    owner_cxy = GET_CXY( owner_xp );
     
    6779    {
    6880
    69 syscall_dmsg("\n[ERROR] in %s : process %x not found\n", __FUNCTION__ , pid );
    70 
     81#if CONFIG_DEBUG_SYSCALLS_ERROR
     82printk("\n[ERROR] in %s : process %x not found\n", __FUNCTION__ , pid );
     83#endif
    7184        this->errno = EINVAL;
    7285        return -1;
     
    7992    ppid       = hal_remote_lw( XPTR( parent_cxy , &parent_ptr->pid ) );
    8093
    81     // processes INIT and processes KSH cannot be stoped or killed
    82     if( ppid < 2 )
     94    // processes INIT
     95    if( pid == 1 )
    8396    {
    8497
    85 syscall_dmsg("\n[ERROR] in %s : process %x cannot be killed\n", __FUNCTION__ , pid );
    86 
     98#if CONFIG_DEBUG_SYSCALLS_ERROR
     99printk("\n[ERROR] in %s : process_init cannot be killed\n", __FUNCTION__ );
     100#endif
    87101                this->errno = EINVAL;
    88102        return -1;
     
    92106    hal_enable_irq( &save_sr );
    93107
    94     // analyse signal type
    95     // supported values are : 0, SIGSTOP, SIGCONT, SIGKILL
     108    // analyse signal type / supported values are : 0, SIGSTOP, SIGCONT, SIGKILL
    96109    switch( sig_id )
    97110    {
     
    108121
    109122            // block all threads in all clusters
    110             process_sigaction( owner_ptr , BLOCK_ALL_THREADS );
     123            process_sigaction( pid , BLOCK_ALL_THREADS );
    111124
    112             // atomically update reference process termination state
     125            // atomically update owner process termination state
    113126            hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) ,
    114                                   PROCESS_FLAG_BLOCK );
     127                                  PROCESS_TERM_STOP );
    115128 
    116129            retval = 0;
     
    120133        {
    121134            // unblock all threads in all clusters
    122             process_sigaction( owner_ptr , UNBLOCK_ALL_THREADS );
     135            process_sigaction( pid , UNBLOCK_ALL_THREADS );
    123136
    124137            // atomically update reference process termination state
    125138            hal_remote_atomic_and( XPTR( owner_cxy , &owner_ptr->term_state ) ,
    126                                    ~PROCESS_FLAG_BLOCK );
     139                                   ~PROCESS_TERM_STOP );
    127140            retval = 0;
    128141            break;
     
    131144        case SIGKILL:
    132145        {
    133             // the process_make_kill() function must be executed
    134             // by an RPC thread in process owner cluster
    135             // It deletes all target process threads in all clusters,
    136             // and updates the process termination state
    137             rpc_process_make_kill_client( owner_cxy , owner_ptr , false , 0 );
     146            // remove TXT ownership from owner process descriptor
     147            process_txt_reset_ownership( owner_xp );
     148
     149            // block all process threads in all clusters
     150            process_sigaction( pid , BLOCK_ALL_THREADS );
     151
     152            // mark all process threads in all clusters for delete
     153            process_sigaction( pid , DELETE_ALL_THREADS );
     154
     155            // atomically update owner process descriptor flags
     156            hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) ,
     157                                  PROCESS_TERM_KILL );
    138158
    139159            retval = 0;
     
    143163        {
    144164
    145 syscall_dmsg("\n[ERROR] in %s : illegal signal type %d for process %x\n",
    146 __FUNCTION__ , sig_id , pid );
    147 
     165#if CONFIG_DEBUG_SYSCALLS_ERROR
     166printk("\n[ERROR] in %s : illegal signal %d / process %x\n", __FUNCTION__, sig_id, pid );
     167#endif
    148168            this->errno = EINVAL;
    149169            retval = -1;
  • trunk/kernel/syscalls/sys_mmap.c

    r407 r435  
    2525#include <hal_types.h>
    2626#include <hal_uspace.h>
     27#include <hal_irqmask.h>
    2728#include <shared_syscalls.h>
    2829#include <errno.h>
     
    4445    error_t       error;
    4546    paddr_t       paddr;        // unused, but required for user space checking
    46 
    47         uint64_t      tm_start;
    48         uint64_t      tm_end;
    49 
    50         tm_start = hal_get_cycles();
     47    reg_t         save_sr;      // required to enable IRQs
    5148
    5249        thread_t    * this    = CURRENT_THREAD;
    5350        process_t   * process = this->process;
    5451
     52#if CONFIG_DEBUG_SYS_MMAP
     53uint64_t      tm_start;
     54uint64_t      tm_end;
     55tm_start = hal_get_cycles();
     56if ( CONFIG_DEBUG_SYS_MMAP < tm_start )
     57printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
     58__FUNCTION__, this, process->pid, (uint32_t)tm_start );
     59#endif
     60
    5561    // check arguments in user space
    5662    error = vmm_v2p_translate( false , attr , &paddr );
     
    5864    if ( error )
    5965    {
    60         printk("\n[ERROR] in %s : arguments not in used space = %x\n",
    61         __FUNCTION__ , (intptr_t)attr );
     66
     67#if CONFIG_DEBUG_SYSCALLS_ERROR
     68printk("\n[ERROR] in %s : arguments not in used space = %x\n", __FUNCTION__ , (intptr_t)attr );
     69#endif
    6270                this->errno = EINVAL;
    6371                return -1;
     
    8290    if( map_fixed )
    8391    {
    84         printk("\n[ERROR] in %s : MAP_FIXED not supported\n", __FUNCTION__ );
     92
     93#if CONFIG_DEBUG_SYSCALLS_ERROR
     94printk("\n[ERROR] in %s : MAP_FIXED not supported\n", __FUNCTION__ );
     95#endif
    8596        this->errno = EINVAL;
    8697        return -1;
     
    89100    if( map_shared == map_private )
    90101    {
    91         printk("\n[ERROR] in %s : MAP_SHARED xor MAP_PRIVATE\n", __FUNCTION__ );
     102
     103#if CONFIG_DEBUG_SYSCALLS_ERROR
     104printk("\n[ERROR] in %s : MAP_SHARED xor MAP_PRIVATE\n", __FUNCTION__ );
     105#endif
    92106        this->errno = EINVAL;
    93107        return -1;
     
    108122                if( fdid >= CONFIG_PROCESS_FILE_MAX_NR )
    109123                {
    110                         printk("\n[ERROR] in %s: bad file descriptor = %d\n", __FUNCTION__ , fdid );
     124
     125#if CONFIG_DEBUG_SYSCALLS_ERROR
     126printk("\n[ERROR] in %s: bad file descriptor = %d\n", __FUNCTION__ , fdid );
     127#endif
    111128            this->errno = EBADFD;
    112129            return -1;
     
    118135        if( file_xp == XPTR_NULL )
    119136        {
    120                         printk("\n[ERROR] in %s: file %d not found\n", __FUNCTION__ , fdid );
     137
     138#if CONFIG_DEBUG_SYSCALLS_ERROR
     139printk("\n[ERROR] in %s: file %d not found\n", __FUNCTION__ , fdid );
     140#endif
    121141            this->errno = EBADFD;
    122142            return -1;
     
    138158                if( (offset + length) > size)
    139159                {
    140                         printk("\n[ERROR] in %s: offset (%d) + len (%d) >= file's size (%d)\n",
    141                         __FUNCTION__, k_attr.offset, k_attr.length, size );
     160
     161#if CONFIG_DEBUG_SYSCALLS_ERROR
     162printk("\n[ERROR] in %s: offset (%d) + len (%d) >= file's size (%d)\n",
     163__FUNCTION__, k_attr.offset, k_attr.length, size );
     164#endif
    142165            this->errno = ERANGE;
    143166            return -1;
     
    148171                    (prot_write && !(file_attr & FD_ATTR_WRITE_ENABLE)) )
    149172                {
    150                         printk("\n[ERROR] in %s: prot = %x / file_attr = %x)\n",
    151                         __FUNCTION__ , k_attr.prot , file_attr );
     173
     174#if CONFIG_DEBUG_SYSCALLS_ERROR
     175printk("\n[ERROR] in %s: prot = %x / file_attr = %x)\n",
     176__FUNCTION__ , k_attr.prot , file_attr );
     177#endif
    152178                        this->errno = EACCES;
    153179                        return -1;
     
    178204            if( cluster_is_undefined( vseg_cxy ) )
    179205            {
    180                 printk("\n[ERROR] in %s : illegal cxy for MAP_REMOTE\n", __FUNCTION__ );
     206
     207#if CONFIG_DEBUG_SYSCALLS_ERROR
     208printk("\n[ERROR] in %s : illegal cxy for MAP_REMOTE\n", __FUNCTION__ );
     209#endif
    181210                this->errno = EINVAL;
    182211                return -1;
     
    184213        }
    185214    }
     215
     216    // enable IRQs
     217    hal_enable_irq( &save_sr );
    186218
    187219    // get reference process cluster and local pointer
     
    216248    }
    217249   
     250    // restore IRQs
     251    hal_restore_irq( save_sr );
     252
    218253    if( vseg == NULL )
    219254    {
    220         printk("\n[ERROR] in %s : cannot create vseg\n", __FUNCTION__ );
     255
     256#if CONFIG_DEBUG_SYSCALLS_ERROR
     257printk("\n[ERROR] in %s : cannot create vseg\n", __FUNCTION__ );
     258#endif
    221259        this->errno = ENOMEM;
    222260        return -1;
     
    226264    hal_copy_to_uspace( &attr->addr , &vseg->min , sizeof(intptr_t) );
    227265
    228     tm_end = hal_get_cycles();
    229 
    230 syscall_dmsg("\n[DBG] %s : core[%x,%d] created vseg %s in cluster %x / cycle %d\n"
    231 "      base = %x / length = %x / cost = %d\n",
    232 __FUNCTION__, local_cxy , this->core->lid , vseg_type_str(vseg->type) ,
    233 vseg->cxy , (uint32_t)tm_start , vseg->min , length , (uint32_t)(tm_end - tm_start) );
     266    hal_fence();
     267
     268#if CONFIG_DEBUG_SYS_MMAP
     269tm_end = hal_get_cycles();
     270if ( CONFIG_DEBUG_SYS_MMAP < tm_start )
     271printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
     272"vseg %s / cluster %x / base %x / size %x / cost %d\n",
     273__FUNCTION__, this, process->pid, (uint32_t)tm_end,
     274vseg_type_str(vseg->type), vseg->cxy, vseg->min, length, (uint32_t)(tm_end - tm_start) );
     275#endif
    234276
    235277        return 0;
  • trunk/kernel/syscalls/sys_read.c

    r433 r435  
    3636// TODO: concurrent user page(s) munmap need to be handled [AG]
    3737
    38 // TODO : remove these debug variables
    3938extern uint32_t enter_sys_read;
    4039extern uint32_t enter_devfs_move;
     
    6463    reg_t        save_sr;     // required to enable IRQs during syscall
    6564
    66 #if CONFIG_READ_DEBUG
     65#if (CONFIG_DEBUG_SYS_READ & 1)
    6766enter_sys_read = (uint32_t)tm_start;
    6867#endif
     
    7675tm_start = hal_get_cycles();
    7776if( CONFIG_DEBUG_SYS_READ < tm_start )
    78 printk("\n[DBG] %s : thread %d enter / process %x / vaddr = %x / count %d / cycle %d\n",
     77printk("\n[DBG] %s : thread %x enter / process %x / vaddr = %x / count %d / cycle %d\n",
    7978__FUNCTION__, this, process->pid, vaddr, count, (uint32_t)tm_start );
    8079#endif
     
    8382        if( file_id >= CONFIG_PROCESS_FILE_MAX_NR )
    8483        {
    85         printk("\n[ERROR] in %s : illegal file descriptor index = %d\n",
    86         __FUNCTION__ , file_id );
     84
     85#if CONFIG_DEBUG_SYSCALLS_ERROR
     86printk("\n[ERROR] in %s : illegal file descriptor index = %d\n", __FUNCTION__ , file_id );
     87#endif
    8788                this->errno = EBADFD;
    8889                return -1;
     
    9495    if ( error )
    9596    {
    96         printk("\n[ERROR] in %s : user buffer unmapped = %x\n",
    97         __FUNCTION__ , (intptr_t)vaddr );
     97
     98#if CONFIG_DEBUG_SYSCALLS_ERROR
     99printk("\n[ERROR] in %s : user buffer unmapped = %x\n",
     100__FUNCTION__ , (intptr_t)vaddr );
     101#endif
    98102                this->errno = EINVAL;
    99103                return -1;
     
    108112    if( file_xp == XPTR_NULL )
    109113    {
    110         printk("\n[ERROR] in %s : undefined file descriptor index = %d in process %x\n",
    111         __FUNCTION__ , file_id , process->pid );
     114
     115#if CONFIG_DEBUG_SYSCALLS_ERROR
     116printk("\n[ERROR] in %s : undefined fd_id %d in process %x\n",
     117__FUNCTION__ , file_id , process->pid );
     118#endif
    112119        this->errno = EBADFD;
    113120        return -1;
     
    122129    if( (attr & FD_ATTR_READ_ENABLE) == 0 )
    123130        {
    124         printk("\n[ERROR] in %s : file %d not readable in process %x\n",
    125         __FUNCTION__ , file_id , process->pid );
     131
     132#if CONFIG_DEBUG_SYSCALLS_ERROR
     133printk("\n[ERROR] in %s : file %d not readable in process %x\n",
     134__FUNCTION__ , file_id , process->pid );
     135#endif
    126136                this->errno = EBADFD;
    127137                return -1;
     
    138148        if( (attr & FD_ATTR_READ_ENABLE) == 0 )
    139149            {
    140             printk("\n[ERROR] in %s : file %d not readable in process %x\n",
    141             __FUNCTION__ , file_id , process->pid );
     150
     151#if CONFIG_DEBUG_SYSCALLS_ERROR
     152printk("\n[ERROR] in %s : file %d not readable in process %x\n",
     153__FUNCTION__ , file_id , process->pid );
     154#endif
    142155                    this->errno = EBADFD;
    143156                    return -1;
     
    166179        if( XPTR( local_cxy , process ) != owner_xp )
    167180        {
    168             printk("\n[ERROR] in %s : process %x not in foreground for TXT%d\n",
    169             __FUNCTION__, process->pid, hal_remote_lw( XPTR(chdev_cxy,&chdev_ptr->channel) ) );
     181
     182#if CONFIG_DEBUG_SYSCALLS_ERROR
     183printk("\n[ERROR] in %s : process %x not in foreground for TXT%d\n",
     184__FUNCTION__, process->pid, hal_remote_lw( XPTR(chdev_cxy,&chdev_ptr->channel) ) );
     185#endif
    170186                    this->errno = EBADFD;
    171187                    return -1;
     
    180196    if( nbytes != count )
    181197    {
    182         printk("\n[ERROR] in %s cannot read data from file %d in process %x\n",
    183         __FUNCTION__ , file_id , process->pid );
     198
     199#if CONFIG_DEBUG_SYSCALLS_ERROR
     200printk("\n[ERROR] in %s cannot read data from file %d in process %x\n",
     201__FUNCTION__ , file_id , process->pid );
     202#endif
    184203        this->errno = error;
    185204        return -1;
     
    194213tm_end = hal_get_cycles();
    195214if( CONFIG_DEBUG_SYS_READ < tm_end )
    196 printk("\n[DBG] %s : thread %x / process %x / cycle %d\n"
     215printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
    197216"nbytes = %d / first byte = %c / file_id = %d / cost = %d\n",
    198217__FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid ,
     
    201220#endif
    202221
    203 #if (CONFIG_READ_DEBUG & 0x1)
     222#if (CONFIG_DEBUG_SYS_READ & 1)
    204223exit_sys_read = (uint32_t)tm_end;
    205224
    206225printk("\n@@@@@@@@@@@@ timing to read character %c\n"
    207 " - enter_sys_read     = %d / delta %d\n"
    208 " - enter_devfs_move   = %d / delta %d\n"
    209 " - enter_txt_read     = %d / delta %d\n"
    210 " - enter_chdev_cmd    = %d / delta %d\n"
    211 " - enter_chdev_server = %d / delta %d\n"
    212 " - enter_tty_cmd      = %d / delta %d\n"
    213 " - enter_tty_isr      = %d / delta %d\n"
    214 " - exit_tty_isr       = %d / delta %d\n"
    215 " - exit_tty_cmd       = %d / delta %d\n"
    216 " - exit_chdev_server  = %d / delta %d\n"
    217 " - exit_chdev_cmd     = %d / delta %d\n"
    218 " - exit_txt_read      = %d / delta %d\n"
    219 " - exit_devfs_move    = %d / delta %d\n"
    220 " - exit_sys_read      = %d / delta %d\n",
     226" - enter_sys_read          = %d / delta %d\n"
     227" - enter_devfs_read        = %d / delta %d\n"
     228" - enter_txt_read          = %d / delta %d\n"
     229" - enter_chdev_cmd_read    = %d / delta %d\n"
     230" - enter_chdev_server_read = %d / delta %d\n"
     231" - enter_tty_cmd_read      = %d / delta %d\n"
     232" - enter_tty_isr_read      = %d / delta %d\n"
     233" - exit_tty_isr_read       = %d / delta %d\n"
     234" - exit_tty_cmd_read       = %d / delta %d\n"
     235" - exit_chdev_server_read  = %d / delta %d\n"
     236" - exit_chdev_cmd_read     = %d / delta %d\n"
     237" - exit_txt_read           = %d / delta %d\n"
     238" - exit_devfs_read         = %d / delta %d\n"
     239" - exit_sys_read           = %d / delta %d\n",
    221240*((char *)(intptr_t)paddr) ,
    222 enter_sys_read     , 0 ,
    223 enter_devfs_move   , enter_devfs_move   - enter_sys_read     ,
    224 enter_txt_read     , enter_txt_read     - enter_devfs_move   ,
    225 enter_chdev_cmd    , enter_chdev_cmd    - enter_txt_read     ,
    226 enter_chdev_server , enter_chdev_server - enter_chdev_cmd    ,
    227 enter_tty_cmd      , enter_tty_cmd      - enter_chdev_server ,
    228 enter_tty_isr      , enter_tty_isr      - enter_tty_cmd      ,
    229 exit_tty_isr       , exit_tty_isr       - enter_tty_isr      ,
    230 exit_tty_cmd       , exit_tty_cmd       - exit_tty_isr       ,
    231 exit_chdev_server  , exit_chdev_server  - exit_tty_cmd       ,
    232 exit_chdev_cmd     , exit_chdev_cmd     - exit_chdev_server  ,
    233 exit_txt_read      , exit_txt_read      - exit_chdev_cmd     ,
    234 exit_devfs_move    , exit_devfs_move    - exit_txt_read      ,
    235 exit_sys_read      , exit_sys_read      - exit_devfs_move    );
     241enter_sys_read          , 0 ,
     242enter_devfs_read        , enter_devfs_read        - enter_sys_read          ,
     243enter_txt_read          , enter_txt_read          - enter_devfs_read        ,
     244enter_chdev_cmd_read    , enter_chdev_cmd_read    - enter_txt_read          ,
     245enter_chdev_server_read , enter_chdev_server_read - enter_chdev_cmd_read    ,
     246enter_tty_cmd_read      , enter_tty_cmd_read      - enter_chdev_server_read ,
     247enter_tty_isr_read      , enter_tty_isr_read      - enter_tty_cmd_read      ,
     248exit_tty_isr_read       , exit_tty_isr_read       - enter_tty_isr_read      ,
     249exit_tty_cmd_read       , exit_tty_cmd_read       - exit_tty_isr_read       ,
     250exit_chdev_server_read  , exit_chdev_server_read  - exit_tty_cmd_read       ,
     251exit_chdev_cmd_read     , exit_chdev_cmd_read     - exit_chdev_server_read  ,
     252exit_txt_read           , exit_txt_read           - exit_chdev_cmd_read     ,
     253exit_devfs_read         , exit_devfs_read         - exit_txt_read           ,
     254exit_sys_read           , exit_sys_read           - exit_devfs_read         );
    236255#endif
    237256 
  • trunk/kernel/syscalls/sys_signal.c

    r409 r435  
    2727#include <thread.h>
    2828#include <printk.h>
    29 #include <signal.h>
    3029
    3130//////////////////////////////////
  • trunk/kernel/syscalls/sys_wait.c

    r433 r435  
    2424#include <hal_types.h>
    2525#include <hal_uspace.h>
     26#include <hal_irqmask.h>
    2627#include <core.h>
    2728#include <thread.h>
     
    4243    int         child_state;
    4344    thread_t  * child_thread;
     45    reg_t       save_sr;
    4446
    4547    thread_t  * this    = CURRENT_THREAD;
     
    6163        if( error )
    6264        {
    63         printk("\n[ERROR] in %s : status buffer unmapped for thread %x in process %x\n",
    64         __FUNCTION__ , this->trdid , process->pid );
     65
     66#if CONFIG_DEBUG_SYSCALLS_ERROR
     67printk("\n[ERROR] in %s : status buffer unmapped for thread %x in process %x\n",
     68__FUNCTION__ , this->trdid , process->pid );
     69#endif
    6570        this->errno = EFAULT;
    6671                return -1;
     
    8590    while( 1 )
    8691    {
     92        // enable IRQS
     93        hal_enable_irq( &save_sr );
     94 
    8795        // get lock protecting children list
    8896        remote_spinlock_lock( children_lock_xp );
     
    101109            // test if child process is terminated,
    102110            // but termination not yet reported to parent process
    103             if( ((child_state & PROCESS_FLAG_EXIT)   ||
    104                  (child_state & PROCESS_FLAG_KILL)   ||
    105                  (child_state & PROCESS_FLAG_BLOCK)) &&
    106                  ((child_state & PROCESS_FLAG_WAIT) == 0) )
     111            if( ((child_state & PROCESS_TERM_EXIT)  ||
     112                 (child_state & PROCESS_TERM_KILL)  ||
     113                 (child_state & PROCESS_TERM_STOP)) &&
     114                 ((child_state & PROCESS_TERM_WAIT) == 0) )
    107115            {
    108116                // get pointer on main thread and PID from child owner process
     
    112120                // set the PROCESS_FLAG_WAIT in owner child descriptor
    113121                hal_remote_atomic_or( XPTR( child_cxy , &child_ptr->term_state ),
    114                                       PROCESS_FLAG_WAIT );
     122                                      PROCESS_TERM_WAIT );
    115123
    116124                // set the THREAD_FLAG_REQ_DELETE in child main thread
     
    118126                                            THREAD_FLAG_REQ_DELETE );
    119127
     128                // release lock protecting children list
     129                remote_spinlock_unlock( children_lock_xp );
     130
    120131#if CONFIG_DEBUG_SYS_WAIT
    121132tm_end = hal_get_cycles();
    122133if( CONFIG_DEBUG_SYS_WAIT < tm_end )
    123 printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n",
    124 __FUNCTION__, this, process->pid, (uint32_t)tm_end );
     134printk("\n[DBG] %s : thread %x exit / parent %x / child %x / cycle %d\n",
     135__FUNCTION__, this, process->pid, child_pid, (uint32_t)tm_end );
    125136#endif
    126 
    127137                 // return relevant info to calling parent process
    128138                 hal_copy_to_uspace( status , &child_state , sizeof(int) );
     
    131141        }
    132142       
    133         // release lock
     143        // release lock protecting children list
    134144        remote_spinlock_unlock( children_lock_xp );
    135145
    136146        // deschedule without blocking
    137147        sched_yield( "parent wait children termination" );
    138     }
     148
     149    }  // end while
    139150
    140151    // never executed
  • trunk/kernel/syscalls/sys_write.c

    r433 r435  
    4141{
    4242    error_t      error;
    43     paddr_t      paddr;           // unused, but required for user space checking
     43    paddr_t      paddr;           // required for user space checking
    4444        xptr_t       file_xp;         // remote file extended pointer
    4545    uint32_t     nbytes;          // number of bytes actually written
    4646    reg_t        save_sr;         // required to enable IRQs during syscall
     47
     48#if (CONFIG_DEBUG_SYS_WRITE_DEBUG & 1)
     49enter_sys_read = (uint32_t)tm_start;
     50#endif
    4751
    4852        thread_t   * this = CURRENT_THREAD;
     
    5458tm_start = hal_get_cycles();
    5559if( CONFIG_DEBUG_SYS_WRITE < tm_start )
    56 printk("\n[DBG] %s : thread %x / process %x / vaddr %x / count %d / cycle %d\n",
     60printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / count %d / cycle %d\n",
    5761__FUNCTION__, this, process->pid, vaddr, count, (uint32_t)tm_start );
    5862#endif
     
    162166tm_end = hal_get_cycles();
    163167if( CONFIG_DEBUG_SYS_WRITE < tm_end )
    164 printk("\n[DBG] %s : thread %x in process %x / cycle %d\n"
     168printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
    165169"nbytes = %d / first byte = %c / file_id = %d / cost = %d\n",
    166170__FUNCTION__, this, process->pid, (uint32_t)tm_start,
     
    168172#endif
    169173 
     174#if (CONFIG_DEBUG_SYS_WRITE & 1)
     175exit_sys_write = (uint32_t)tm_end;
     176
     177printk("\n@@@@@@@@@@@@ timing to write string %c\n"
     178" - enter_sys_write          = %d / delta %d\n"
     179" - enter_devfs_write        = %d / delta %d\n"
     180" - enter_txt_write          = %d / delta %d\n"
     181" - enter_chdev_cmd_write    = %d / delta %d\n"
     182" - enter_chdev_server_write = %d / delta %d\n"
     183" - enter_tty_cmd_write      = %d / delta %d\n"
     184" - enter_tty_isr_write      = %d / delta %d\n"
     185" - exit_tty_isr_write       = %d / delta %d\n"
     186" - exit_tty_cmd_write       = %d / delta %d\n"
     187" - exit_chdev_server_write  = %d / delta %d\n"
     188" - exit_chdev_cmd_write     = %d / delta %d\n"
     189" - exit_txt_write           = %d / delta %d\n"
     190" - exit_devfs_write         = %d / delta %d\n"
     191" - exit_sys_write           = %d / delta %d\n",
     192*((char *)(intptr_t)paddr) ,
     193enter_sys_write          , 0 ,
     194enter_devfs_write        , enter_devfs_write        - enter_sys_write          ,
     195enter_txt_write          , enter_txt_write          - enter_devfs_write        ,
     196enter_chdev_cmd_write    , enter_chdev_cmd_write    - enter_txt_write          ,
     197enter_chdev_server_write , enter_chdev_server_write - enter_chdev_cmd_write    ,
     198enter_tty_cmd_write      , enter_tty_cmd_write      - enter_chdev_server_write ,
     199enter_tty_isr_write      , enter_tty_isr_write      - enter_tty_cmd_write      ,
     200exit_tty_isr_write       , exit_tty_isr_write       - enter_tty_isr_write      ,
     201exit_tty_cmd_write       , exit_tty_cmd_write       - exit_tty_isr_write       ,
     202exit_chdev_server_write  , exit_chdev_server_write  - exit_tty_cmd_write       ,
     203exit_chdev_cmd_write     , exit_chdev_cmd_write     - exit_chdev_server_write  ,
     204exit_txt_write           , exit_txt_write           - exit_chdev_cmd_write     ,
     205exit_devfs_write         , exit_devfs_write         - exit_txt_write           ,
     206exit_sys_write           , exit_sys_write           - exit_devfs_write         );
     207#endif
     208 
    170209        return nbytes;
    171210
  • trunk/kernel/syscalls/syscalls.h

    r433 r435  
    508508 * The following macros can be used to extract information from status:
    509509 * - WIFEXITED(status)   : is true if the child process terminated with an exit().
    510  * - WIFSIGNALED(status) : is true if the child process terminated by a signal.
     510 * - WIFSIGNALED(status) : is true if the child process killed by a signal.
    511511 * - WIFSTOPPED(status)  : is true if the child process is stopped by a signal.
    512512 * - WEXITSTATUS(status) : returns the low-order 8 bits of the exit() argument.
     
    558558 * [43] This debug function displays on the kernel terminal TXT0 an user defined string,
    559559 * or the current state of a kernel structure, identified by the <type> argument.
    560  * The <arg0> and <arg1> arguments depends on the structure type. It can be:
    561  * - VMM     : VSL and GPT for a process identified by <pid>.
    562  * - SCHED   : all threads allocated to a scheduler identified by <cxy> & <lid>.
    563  * - PROCESS : all processes registered in a cluster identified by <cxy>. 
    564  * - VFS     : all files registered in the VFS cache.
    565  * - CHDEV   : all registered channel devices.
    566  ******************************************************************************************
    567  * type     : [in] STRING / VMM / SCHED / PROCESS / VSEG / VFS
     560 * The <arg0> and <arg1> arguments depends on the structure type:
     561 * - DISPLAY_STRING          : an user defined string
     562 * - DISPLAY_VMM             : VSL and GPT for a process identified by <pid>.
     563 * - DISPLAY_SCHED           : all threads allocated to a scheduler <cxy> & <lid>.
     564 * - DISPLAY_CLUSTER_PROCESS : all processes registered in a cluster identified by <cxy>. 
     565 * - DISPLAY_TXT_PROCESS     : all processes registered in a cluster identified by <cxy>. 
     566 * - DISPLAY_VFS             : all files registered in the VFS cache.
     567 * - DISPLAY_CHDEV           : all registered channel devices.
     568 ******************************************************************************************
     569 * type      : [in] type of display
    568570 * arg0      : [in] type dependant argument.
    569571 * arg1      : [in] type dependant argument.
Note: See TracChangeset for help on using the changeset viewer.