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

blip

File:
1 edited

Legend:

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

    r428 r433  
    44 * Authors  Ghassan Almaless (2008,2009,2010,2011,2012)
    55 *          Mohamed Lamine Karaoui (2015)
    6  *          Alain Greiner (2016,2017)
     6 *          Alain Greiner (2016,2017,2018)
    77 *
    88 * Copyright (c) UPMC Sorbonne Universites
     
    124124    model_pid  = hal_remote_lw( XPTR( model_cxy  , &model_ptr->pid ) );
    125125
    126 process_dmsg("\n[DBG] %s : core[%x,%d] enters / pid = %x / ppid = %x / model_pid = %x\n",
    127 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , pid , parent_pid , model_pid );
     126#if CONFIG_DEBUG_PROCESS_REFERENCE_INIT
     127uint32_t cycle = (uint32_t)hal_get_cycles();
     128if( CONFIG_DEBUG_PROCESS_REFERENCE_INIT )
     129printk("\n[DBG] %s : thread %x enter / pid = %x / ppid = %x / model_pid = %x / cycle %d\n",
     130__FUNCTION__ , CURRENT_THREAD , pid , parent_pid , model_pid , cycle );
     131#endif
    128132
    129133    // initialize PID, REF_XP, PARENT_XP, and STATE
    130         process->pid       = pid;
    131     process->ref_xp    = XPTR( local_cxy , process );
    132     process->parent_xp = parent_xp;
    133     process->state     = PROCESS_STATE_RUNNING;
     134        process->pid        = pid;
     135    process->ref_xp     = XPTR( local_cxy , process );
     136    process->parent_xp  = parent_xp;
     137    process->term_state = 0;
    134138
    135139    // initialize vmm as empty
     
    137141    assert( (error == 0) , __FUNCTION__ , "cannot initialize VMM\n" );
    138142 
    139 process_dmsg("\n[DBG] %s : core[%x,%d] / vmm inialised as empty for process %x\n",
    140 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , pid );
     143#if (CONFIG_DEBUG_PROCESS_REFERENCE_INIT & 1)
     144cycle = (uint32_t)hal_get_cycles();
     145if( CONFIG_DEBUG_PROCESS_REFERENCE_INIT )
     146printk("\n[DBG] %s : thread %x / vmm empty for process %x / cycle %d\n",
     147__FUNCTION__ , CURRENT_THREAD , pid , cycle );
     148#endif
    141149
    142150    // initialize fd_array as empty
     
    224232    remote_rwlock_init( XPTR( local_cxy , &process->cwd_lock ) );
    225233
    226 process_dmsg("\n[DBG] %s : core[%x,%d] / fd array initialised for process %x\n",
    227 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , pid );
     234#if (CONFIG_DEBUG_PROCESS_REFERENCE_INIT & 1)
     235cycle = (uint32_t)hal_get_cycles();
     236if( CONFIG_DEBUG_PROCESS_REFERENCE_INIT )
     237printk("\n[DBG] %s : thread %x / fd_array for process %x / cycle %d\n",
     238__FUNCTION__ , CURRENT_THREAD , pid , cycle );
     239#endif
    228240
    229241    // reset children list root
     
    260272        hal_fence();
    261273
    262 process_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x\n",
    263 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , pid );
     274#if (CONFIG_DEBUG_PROCESS_REFERENCE_INIT & 1)
     275cycle = (uint32_t)hal_get_cycles();
     276if( CONFIG_DEBUG_PROCESS_REFERENCE_INIT )
     277printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n",
     278__FUNCTION__ , CURRENT_THREAD , pid , cycle );
     279#endif
    264280
    265281}  // process_reference_init()
     
    276292
    277293    // initialize PID, REF_XP, PARENT_XP, and STATE
    278     local_process->pid       = hal_remote_lw(  XPTR( ref_cxy , &ref_ptr->pid ) );
    279     local_process->parent_xp = hal_remote_lwd( XPTR( ref_cxy , &ref_ptr->parent_xp ) );
    280     local_process->ref_xp    = reference_process_xp;
    281     local_process->state     = PROCESS_STATE_RUNNING;
    282 
    283 process_dmsg("\n[DBG] %s : core[%x,%d] enters for process %x\n",
    284 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , local_process->pid );
     294    local_process->pid        = hal_remote_lw(  XPTR( ref_cxy , &ref_ptr->pid ) );
     295    local_process->parent_xp  = hal_remote_lwd( XPTR( ref_cxy , &ref_ptr->parent_xp ) );
     296    local_process->ref_xp     = reference_process_xp;
     297    local_process->term_state = 0;
     298
     299#if CONFIG_DEBUG_PROCESS_COPY_INIT
     300uint32_t cycle = (uint32_t)hal_get_cycles();
     301if( CONFIG_DEBUG_PROCESS_COPY_INIT )
     302printk("\n[DBG] %s : thread %x enter for process %x\n",
     303__FUNCTION__ , CURRENT_THREAD , local_process->pid );
     304#endif
    285305
    286306    // reset local process vmm
     
    327347        hal_fence();
    328348
    329 process_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x\n",
    330 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , local_process->pid );
     349#if CONFIG_DEBUG_PROCESS_COPY_INIT
     350cycle = (uint32_t)hal_get_cycles();
     351if( CONFIG_DEBUG_PROCESS_COPY_INIT )
     352printk("\n[DBG] %s : thread %x exit for process %x\n",
     353__FUNCTION__ , CURRENT_THREAD , local_process->pid );
     354#endif
    331355
    332356    return 0;
     
    347371    "process %x in cluster %x has still active threads", process->pid , local_cxy );
    348372
    349 process_dmsg("\n[DBG] %s : core[%x,%d] enter for process %x\n",
    350 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , process->pid );
     373#if CONFIG_DEBUG_PROCESS_DESTROY
     374uint32_t cycle = (uint32_t)hal_get_cycles();
     375if( CONFIG_DEBUG_PROCESS_DESTROY )
     376printk("\n[DBG] %s : thread %x enter to destroy process %x (pid = %x) / cycle %d\n",
     377__FUNCTION__ , CURRENT_THREAD , process, process->pid , cycle );
     378#endif
    351379
    352380    // get local process manager pointer
     
    386414        xlist_unlink( XPTR( local_cxy , &process->children_list ) );
    387415        remote_spinlock_unlock( children_lock_xp );
    388 
    389         // get extende pointer on parent main thread
    390         parent_thread_xp = XPTR( parent_cxy ,
    391                            hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->th_tbl[1] )));
    392        
    393         // unblock parent process main thread
    394         thread_unblock( parent_thread_xp , THREAD_BLOCKED_WAIT );
    395416    }
    396417
     
    411432    process_free( process );
    412433
    413 process_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x\n",
    414 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , process->pid );
     434#if CONFIG_DEBUG_PROCESS_DESTROY
     435cycle = (uint32_t)hal_get_cycles();
     436if( CONFIG_DEBUG_PROCESS_DESTROY )
     437printk("\n[DBG] %s : thread %x exit / destroyed process %x (pid = %x) / cycle %d\n",
     438__FUNCTION__ , CURRENT_THREAD , process, process->pid, cycle );
     439#endif
    415440
    416441}  // end process_destroy()
     
    440465    uint32_t           responses;         // number of remote process copies
    441466    uint32_t           rsp_count;         // used to assert number of copies
    442 
    443467    rpc_desc_t         rpc;               // rpc descriptor allocated in stack
    444468
    445 process_dmsg("\n[DBG] %s : enter to %s process %x in cluster %x\n",
    446 __FUNCTION__ , process_action_str( action_type ) , process->pid , local_cxy );
     469#if CONFIG_DEBUG_PROCESS_SIGACTION
     470uint32_t cycle = (uint32_t)hal_get_cycles();
     471if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     472printk("\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 ) ,
     474process->pid , local_cxy , cycle );
     475#endif
    447476
    448477    thread_t         * client = CURRENT_THREAD;
    449     xptr_t             client_xp = XPTR( local_cxy , client );
    450478
    451479    // get local pointer on local cluster manager
     
    492520        {
    493521
    494 process_dmsg("\n[DBG] %s : send RPC to remote cluster %x\n",
    495 __FUNCTION__ , process_cxy );
     522#if CONFIG_DEBUG_PROCESS_SIGACTION
     523if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     524printk("\n[DBG] %s : send RPC to remote cluster %x\n", __FUNCTION__ , process_cxy );
     525#endif
    496526
    497527            rpc.args[0] = (uint64_t)action_type;
     
    517547    }
    518548
    519 process_dmsg("\n[DBG] %s : make action in owner cluster %x\n",
    520 __FUNCTION__ , local_cxy );
    521 
     549#if CONFIG_DEBUG_PROCESS_SIGACTION
     550if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     551printk("\n[DBG] %s : make action in owner cluster %x\n", __FUNCTION__ , local_cxy );
     552#endif
    522553
    523554    // call directly the relevant function in local owner cluster
    524     if      (action_type == DELETE_ALL_THREADS  ) process_delete_threads ( process , client_xp );
    525     else if (action_type == BLOCK_ALL_THREADS   ) process_block_threads  ( process , client_xp );
    526     else if (action_type == UNBLOCK_ALL_THREADS ) process_unblock_threads( process             );
    527 
    528 process_dmsg("\n[DBG] %s : exit after %s process %x in cluster %x\n",
    529 __FUNCTION__ , process_action_str( action_type ) , process->pid , local_cxy );
     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 );
     558
     559#if CONFIG_DEBUG_PROCESS_SIGACTION
     560cycle = (uint32_t)hal_get_cycles();
     561if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     562printk("\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 ) ,
     564process->pid , local_cxy , cycle );
     565#endif
    530566
    531567}  // end process_sigaction()
    532568
    533 ////////////////////////////////////////////////
    534 void process_block_threads( process_t * process,
    535                             xptr_t      client_xp )
     569/////////////////////////////////////////////////
     570void process_block_threads( process_t * process )
    536571{
    537572    thread_t          * target;         // pointer on target thread
     573    thread_t          * this;           // pointer on calling thread
    538574    uint32_t            ltid;           // index in process th_tbl
    539     thread_t          * requester;      // requesting thread pointer
    540575    uint32_t            count;          // requests counter
    541576    volatile uint32_t   rsp_count;      // responses counter
    542577
    543578    // get calling thread pointer
    544     requester = CURRENT_THREAD;
    545 
    546 sigaction_dmsg("\n[DBG] %s : enter for process %x in cluster %x\n",
    547 __FUNCTION__ , process->pid , local_cxy );
     579    this = CURRENT_THREAD;
     580
     581#if CONFIG_DEBUG_PROCESS_SIGACTION
     582uint32_t cycle = (uint32_t)hal_get_cycles();
     583if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     584printk("\n[DBG] %s : thread %x enter for process %x in cluster %x / cycle %d\n",
     585__FUNCTION__ , this , process->pid , local_cxy , cycle );
     586#endif
    548587
    549588    // get lock protecting process th_tbl[]
     
    559598        target = process->th_tbl[ltid];
    560599
     600        assert( (target != this) , __FUNCTION__ , "calling thread cannot be a target\n" );
     601
    561602        if( target != NULL )             // thread found
    562603        {
    563604            count++;
    564605
    565             // - if the target thread is the client thread, we do nothing,
    566             //   and we simply decrement the responses counter.
    567606            // - if the calling thread and the target thread are on the same core,
    568607            //   we block the target thread, we don't need confirmation from scheduler,
     
    572611            //   to be sure that the target thread is not running.
    573612           
    574             if( XPTR( local_cxy , target ) == client_xp )
    575             {
    576                 // decrement responses counter
    577                 hal_atomic_add( (void *)&rsp_count , -1 );
    578             }
    579             else if( requester->core->lid == target->core->lid )
     613            if( this->core->lid == target->core->lid )
    580614            {
    581615                // set the global blocked bit in target thread descriptor.
     
    612646    }
    613647
    614 sigaction_dmsg("\n[DBG] %s : exit for process %x in cluster %x / %d threads blocked\n",
    615 __FUNCTION__ , process->pid , local_cxy , count );
     648#if CONFIG_DEBUG_PROCESS_SIGACTION
     649cycle = (uint32_t)hal_get_cycles();
     650if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     651printk("\n[DBG] %s : thread %x exit for process %x in cluster %x / cycle %d\n",
     652__FUNCTION__ , this , process->pid , local_cxy , cycle );
     653#endif
    616654
    617655}  // end process_block_threads()
     
    621659{
    622660    thread_t          * target;        // pointer on target thead
     661    thread_t          * this;          // pointer on calling thread
    623662    uint32_t            ltid;          // index in process th_tbl
    624663    uint32_t            count;         // requests counter
    625664
    626 sigaction_dmsg("\n[DBG] %s : enter for process %x in cluster %x\n",
    627 __FUNCTION__ , process->pid , local_cxy );
     665    // get calling thread pointer
     666    this = CURRENT_THREAD;
     667
     668#if CONFIG_DEBUG_PROCESS_SIGACTION
     669uint32_t cycle = (uint32_t)hal_get_cycles();
     670if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     671printk("\n[DBG] %s : thread %x enter for process %x in cluster %x / cycle %d\n",
     672__FUNCTION__ , this , process->pid , local_cxy , cycle );
     673#endif
    628674
    629675    // get lock protecting process th_tbl[]
     
    636682        target = process->th_tbl[ltid];
    637683
     684        assert( (target != this) , __FUNCTION__ , "calling thread cannot be a target\n" );
     685
    638686        if( target != NULL )             // thread found
    639687        {
     
    648696    spinlock_unlock( &process->th_lock );
    649697
    650 sigaction_dmsg("\n[DBG] %s : exit for process %x in cluster %x / %d threads blocked\n",
    651 __FUNCTION__ , process->pid , local_cxy , count );
     698#if CONFIG_DEBUG_PROCESS_SIGACTION
     699cycle = (uint32_t)hal_get_cycles();
     700if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     701printk("\n[DBG] %s : thread %x exit for process %x in cluster %x / cycle %d\n",
     702__FUNCTION__ , this , process->pid , local_cxy , cycle );
     703#endif
    652704
    653705}  // end process_unblock_threads()
    654706
    655 /////////////////////////////////////////////////
    656 void process_delete_threads( process_t * process,
    657                              xptr_t      client_xp )
     707//////////////////////////////////////////////////
     708void process_delete_threads( process_t * process )
    658709{
    659710    thread_t          * target;        // pointer on target thread
     711    thread_t          * this;          // pointer on calling thread
    660712    uint32_t            ltid;          // index in process th_tbl
    661713    uint32_t            count;         // request counter
    662 
    663 sigaction_dmsg("\n[DBG] %s : enter for process %x in cluster %x at cycle %d\n",
    664 __FUNCTION__ , process->pid , local_cxy , (uint32_t)hal_get_cycles() );
     714    cxy_t               owner_cxy;     // owner cluster identifier
     715
     716    // get calling thread pointer
     717    this = CURRENT_THREAD;
     718    owner_cxy = CXY_FROM_PID( process->pid );
     719
     720#if CONFIG_DEBUG_PROCESS_SIGACTION
     721uint32_t cycle = (uint32_t)hal_get_cycles();
     722if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     723printk("\n[DBG] %s : thread %x enter for process %x in cluster %x / cycle %d\n",
     724__FUNCTION__ , this , process->pid , local_cxy , cycle );
     725#endif
    665726
    666727    // get lock protecting process th_tbl[]
     
    673734        target = process->th_tbl[ltid];
    674735
    675         if( target != NULL )             // thread found
     736        assert( (target != this) , __FUNCTION__ , "calling thread cannot be a target\n" );
     737
     738        if( target != NULL )            // thread found
    676739        {
    677740            count++;
    678 
    679             // delete only if the target is not the client
    680             if( XPTR( local_cxy , target ) != client_xp )
    681             { 
     741           
     742            // the main thread should not be deleted
     743            if( (owner_cxy != local_cxy) || (ltid != 0) ) 
     744            {
    682745                hal_atomic_or( &target->flags , THREAD_FLAG_REQ_DELETE );
    683746            }
     
    688751    spinlock_unlock( &process->th_lock );
    689752
    690 sigaction_dmsg("\n[DBG] %s : exit for process %x in cluster %x at cycle %d\n",
    691 __FUNCTION__ , process->pid , local_cxy , (uint32_t)hal_get_cycles() );
     753#if CONFIG_DEBUG_PROCESS_SIGACTION
     754cycle = (uint32_t)hal_get_cycles();
     755if( CONFIG_DEBUG_PROCESS_SIGACTION < cycle )
     756printk("\n[DBG] %s : thread %x exit for process %x in cluster %x / cycle %d\n",
     757__FUNCTION__ , this , process->pid , local_cxy , cycle );
     758#endif
    692759
    693760}  // end process_delete_threads()
     
    9881055    "parent process must be the reference process\n" );
    9891056
    990 fork_dmsg("\n[DBG] %s : core[%x,%d] enter at cycle %d\n",
    991 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid , (uint32_t)hal_get_cycles() );
     1057#if CONFIG_DEBUG_PROCESS_MAKE_FORK
     1058uint32_t cycle = (uint32_t)hal_get_cycles();
     1059if( CONFIG_DEBUG_PROCESS_MAKE_FORK < cycle )
     1060printk("\n[DBG] %s : thread %x enter for process %x / cycle %d\n",
     1061__FUNCTION__, CURRENT_THREAD, parent_pid, cycle );
     1062#endif
    9921063
    9931064    // allocate a process descriptor
     
    9991070        return -1;
    10001071    }
    1001 
    1002 fork_dmsg("\n[DBG] %s : core[%x,%d] created child process %x at cycle %d\n",
    1003  __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process, (uint32_t)hal_get_cycles() );
    10041072
    10051073    // allocate a child PID from local cluster
     
    10121080        return -1;
    10131081    }
    1014 
    1015 fork_dmsg("\n[DBG] %s : core[%x, %d] child process PID = %x at cycle %d\n",
    1016  __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, new_pid , (uint32_t)hal_get_cycles() );
    10171082
    10181083    // initializes child process descriptor from parent process descriptor
     
    10221087                            parent_process_xp );
    10231088
    1024 fork_dmsg("\n[DBG] %s : core[%x, %d] child process initialised at cycle %d\n",
    1025 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, hal_get_cycles() );
     1089#if CONFIG_DEBUG_PROCESS_MAKE_FORK
     1090cycle = (uint32_t)hal_get_cycles();
     1091if( CONFIG_DEBUG_PROCESS_MAKE_FORK < cycle )
     1092printk("\n[DBG] %s : thread %x created child_process %x / child_pid %x / cycle %d\n",
     1093__FUNCTION__, CURRENT_THREAD, process, new_pid, cycle );
     1094#endif
    10261095
    10271096    // copy VMM from parent descriptor to child descriptor
     
    10371106    }
    10381107
    1039 fork_dmsg("\n[DBG] %s : core[%x, %d] child process VMM copied at cycle %d\n",
    1040 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
     1108#if CONFIG_DEBUG_PROCESS_MAKE_FORK
     1109cycle = (uint32_t)hal_get_cycles();
     1110if( CONFIG_DEBUG_PROCESS_MAKE_FORK < cycle )
     1111printk("\n[DBG] %s : thread %x copied VMM from parent %x to child %x / cycle %d\n",
     1112__FUNCTION__ , CURRENT_THREAD , parent_pid, new_pid, cycle );
     1113#endif
    10411114
    10421115    // update extended pointer on .elf file
     
    10591132    assert( (thread->trdid == 0) , __FUNCTION__ , "main thread must have index 0\n" );
    10601133
    1061 fork_dmsg("\n[DBG] %s : core[%x,%d] child thread created at cycle %d\n",
    1062 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
    1063 
    1064     // update parent process GPT to set Copy_On_Write for shared data vsegs
     1134#if CONFIG_DEBUG_PROCESS_MAKE_FORK
     1135cycle = (uint32_t)hal_get_cycles();
     1136if( CONFIG_DEBUG_PROCESS_MAKE_FORK < cycle )
     1137printk("\n[DBG] %s : thread %x created child thread %x / cycle %d\n",
     1138__FUNCTION__ , CURRENT_THREAD, thread, cycle );
     1139#endif
     1140
     1141    // set Copy_On_Write flag in parent process GPT
    10651142    // this includes all replicated GPT copies
    10661143    if( parent_process_cxy == local_cxy )   // reference is local
     
    10741151    }
    10751152
    1076 fork_dmsg("\n[DBG] %s : core[%x,%d] COW set in parent_process at cycle %d\n",
    1077 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
     1153    // set Copy_On_Write flag in child process GPT
     1154    vmm_set_cow( process );
     1155 
     1156#if CONFIG_DEBUG_PROCESS_MAKE_FORK
     1157cycle = (uint32_t)hal_get_cycles();
     1158if( CONFIG_DEBUG_PROCESS_MAKE_FORK < cycle )
     1159printk("\n[DBG] %s : thread %x set COW in parent and child / cycle %d\n",
     1160__FUNCTION__ , CURRENT_THREAD, cycle );
     1161#endif
    10781162
    10791163    // get extended pointers on parent children_root, children_lock and children_nr
     
    10921176    *child_pid    = new_pid;
    10931177
    1094 
    1095 fork_dmsg("\n[DBG] %s : core[%x,%d] exit at cycle %d\n",
    1096 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
     1178#if CONFIG_DEBUG_PROCESS_MAKE_FORK
     1179cycle = (uint32_t)hal_get_cycles();
     1180if( CONFIG_DEBUG_PROCESS_MAKE_FORK < cycle )
     1181printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     1182__FUNCTION__, CURRENT_THREAD, cycle );
     1183#endif
    10971184
    10981185    return 0;
     
    11051192{
    11061193    char           * path;                    // pathname to .elf file
    1107     pid_t            pid;                     // old_process PID given to new_process
    1108     pid_t            temp_pid;                // temporary PID given to old_process
     1194    pid_t            pid;                     // old_process PID / given to new_process
     1195    pid_t            temp_pid;                // temporary PID / given to old_process
    11091196    process_t      * old_process;             // local pointer on old process
     1197    thread_t       * old_thread;              // local pointer on old thread
    11101198    process_t      * new_process;             // local pointer on new process
    1111     thread_t       * new_thread;              // local pointer on main thread
    1112     pthread_attr_t   attr;                    // main thread attributes
     1199    thread_t       * new_thread;              // local pointer on new thread
     1200    xptr_t           parent_xp;               // extended pointer on parent process
     1201    pthread_attr_t   attr;                    // new thread attributes
    11131202    lid_t            lid;                     // selected core local index
    11141203        error_t          error;
    11151204
    1116         // get .elf pathname and PID from exec_info
     1205    // get old_thread / old_process / PID / parent_xp
     1206    old_thread  = CURRENT_THREAD;
     1207    old_process = old_thread->process;
     1208    pid         = old_process->pid;
     1209    parent_xp   = old_process->parent_xp;
     1210   
     1211        // get .elf pathname from exec_info
    11171212        path     = exec_info->path;
    1118     pid      = exec_info->pid;
    11191213
    11201214    // this function must be executed by a thread running in owner cluster
    11211215    assert( (CXY_FROM_PID( pid ) == local_cxy), __FUNCTION__,
    1122     "local cluster %x is not owner for process %x\n", local_cxy, pid );
    1123 
    1124 exec_dmsg("\n[DBG] %s : core[%x,%d] enters for process %x / %s / cycle %d\n",
    1125 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, pid, path, (uint32_t)hal_get_cycles() );
    1126 
    1127     // get old_process local pointer
    1128     old_process = (process_t *)cluster_get_local_process_from_pid( pid );
    1129    
    1130     if( old_process == NULL )
    1131     {
    1132         printk("\n[ERROR] in %s : cannot get old process descriptor\n", __FUNCTION__ );
    1133         return -1;
    1134     }
     1216    "local_cluster must be owner_cluster\n" );
     1217
     1218    assert( (LTID_FROM_TRDID( old_thread->trdid ) == 0) , __FUNCTION__,
     1219    "must be called by the main thread\n" );
     1220 
     1221#if CONFIG_DEBUG_PROCESS_MAKE_EXEC
     1222uint32_t cycle = (uint32_t)hal_get_cycles();
     1223if( CONFIG_DEBUG_PROCESS_MAKE_EXEC < cycle )
     1224printk("\n[DBG] %s : thread %x enters for process %x / %s / cycle %d\n",
     1225__FUNCTION__, old_thread, pid, path, cycle );
     1226#endif
    11351227
    11361228     // allocate memory for new_process descriptor
     
    11441236    }
    11451237
    1146     // get a new PID for old_process
     1238    // get a temporary PID for old_process
    11471239    error = cluster_pid_alloc( old_process , &temp_pid );
    11481240    if( error )
     
    11541246    }
    11551247
    1156     // request blocking for all threads in old_process (but the calling thread)
    1157     process_sigaction( old_process , BLOCK_ALL_THREADS );
    1158 
    1159     // request destruction for all threads in old_process (but the calling thread)
    1160     process_sigaction( old_process , DELETE_ALL_THREADS );
    1161 
    1162 exec_dmsg("\n[DBG] %s : core[%x,%d] marked old threads for destruction / cycle %d\n",
    1163 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid , (uint32_t)hal_get_cycles() );
    1164 
    1165     // set new PID to old_process
     1248    // set temporary PID to old_process
    11661249    old_process->pid = temp_pid;
    11671250
     
    11691252    process_reference_init( new_process,
    11701253                            pid,
    1171                             old_process->parent_xp,             // parent_process_xp
    1172                             XPTR(local_cxy , old_process) );    // model_process_xp
     1254                            parent_xp,                          // parent_process_xp
     1255                            XPTR(local_cxy , old_process) );    // model_process
    11731256
    11741257    // give TXT ownership to new_process
    11751258    process_txt_set_ownership( XPTR( local_cxy , new_process ) );
    11761259
    1177 exec_dmsg("\n[DBG] %s : core[%x,%d] initialised new process %x / cycle %d \n",
    1178 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, new_process, (uint32_t)hal_get_cycles() );
     1260#if CONFIG_DEBUG_PROCESS_MAKE_EXEC
     1261cycle = (uint32_t)hal_get_cycles();
     1262if( CONFIG_DEBUG_PROCESS_MAKE_EXEC < cycle )
     1263printk("\n[DBG] %s : thread %x created new process %x / cycle %d \n",
     1264__FUNCTION__ , old_thread , new_process , cycle );
     1265#endif
    11791266
    11801267    // register code & data vsegs as well as entry-point in new process VMM,
     
    11881275        }
    11891276
    1190 exec_dmsg("\n[DBG] %s : core[%x,%d] vsegs registered in new process %x / cycle %d\n",
    1191 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, new_process, (uint32_t)hal_get_cycles() );
     1277#if CONFIG_DEBUG_PROCESS_MAKE_EXEC
     1278cycle = (uint32_t)hal_get_cycles();
     1279if( CONFIG_DEBUG_PROCESS_MAKE_EXEC < cycle )
     1280printk("\n[DBG] %s : thread %x registered code/data vsegs in new process %x / cycle %d\n",
     1281__FUNCTION__, old_thread , new_process->pid , cycle );
     1282#endif
    11921283
    11931284    // select a core in local cluster to execute the main thread
     
    12161307    assert( (new_thread->trdid == 0) , __FUNCTION__ , "main thread must have index 0\n" );
    12171308
    1218 exec_dmsg("\n[DBG] %s : core[%x,%d] created new_process main thread / cycle %d\n",
    1219 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
    1220 
    1221     // get pointers on parent process
    1222     xptr_t      parent_xp  = new_process->parent_xp;
     1309#if CONFIG_DEBUG_PROCESS_MAKE_EXEC
     1310cycle = (uint32_t)hal_get_cycles();
     1311if( CONFIG_DEBUG_PROCESS_MAKE_EXEC < cycle )
     1312printk("\n[DBG] %s : thread %x created new_process main thread %x / cycle %d\n",
     1313__FUNCTION__ , old_thread , new_thread , cycle );
     1314#endif
     1315
     1316    // get cluster and local pointer on parent process
    12231317    process_t * parent_ptr = GET_PTR( parent_xp );
    12241318    cxy_t       parent_cxy = GET_CXY( parent_xp );
     
    12351329    remote_spinlock_unlock( lock_xp );
    12361330
    1237 exec_dmsg("\n[DBG] %s : core[%x,%d] updated parent process children list / cycle %d\n",
    1238 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
    1239    
    1240     // block and mark calling thread for deletion
    1241     // only when it is an user thread
    1242     thread_t * this = CURRENT_THREAD;
    1243     if( this->type == THREAD_USER )
    1244     {
    1245         thread_block( this , THREAD_BLOCKED_GLOBAL );
    1246         hal_atomic_or( &this->flags , THREAD_FLAG_REQ_DELETE );
    1247     }
    1248 
    12491331    // activate new thread
    12501332        thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    12511333
     1334    // request old_thread destruction => old_process destruction
     1335    thread_block( old_thread , THREAD_BLOCKED_GLOBAL );
     1336    hal_atomic_or( &old_thread->flags , THREAD_FLAG_REQ_DELETE );
     1337
    12521338    hal_fence();
    12531339
    1254 exec_dmsg("\n[DBG] %s : core[%x,%d] exit for path = %s / cycle %d\n",
    1255 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path , (uint32_t)hal_get_cycles() );
    1256 
     1340#if CONFIG_DEBUG_PROCESS_MAKE_EXEC
     1341cycle = (uint32_t)hal_get_cycles();
     1342if( CONFIG_DEBUG_PROCESS_MAKE_EXEC < cycle )
     1343printk("\n[DBG] %s : old_thread %x blocked / new_thread %x activated / cycle %d\n",
     1344__FUNCTION__ , old_thread , new_thread , cycle );
     1345#endif
     1346   
    12571347        return 0;
    12581348
    12591349}  // end process_make_exec()
    12601350
    1261 ///////////////////////////////////////
    1262 void process_make_kill( pid_t      pid,
    1263                         uint32_t   sig_id )
    1264 {
    1265     // this function must be executed by a thread running in owner cluster
    1266     assert( (CXY_FROM_PID( pid ) == local_cxy) , __FUNCTION__ ,
    1267     "must execute in owner cluster" );
    1268 
     1351////////////////////////////////////////////
     1352void process_make_kill( process_t * process,
     1353                        bool_t      is_exit,
     1354                        uint32_t    exit_status )
     1355{
    12691356    thread_t * this = CURRENT_THREAD;
    12701357
    1271 kill_dmsg("\n[DBG] %s : core[%x,%d] enter / process %x / sig %d\n",
    1272 __FUNCTION__, local_cxy, this->core->lid, pid , sig_id );
    1273 
    1274     // get pointer on local target process descriptor
    1275     process_t * process = process_get_local_copy( pid );
    1276 
    1277     // does nothing if process does not exist
    1278     if( process == NULL )
    1279     {
    1280         printk("\n[WARNING] %s : process %x does not exist => do nothing\n",
    1281         __FUNCTION__ , pid );
    1282         return;
    1283     }
    1284 
    1285     // analyse signal type
    1286     switch( sig_id )
    1287     {
    1288         case SIGSTOP:     
    1289         {
    1290             // block all threads in all clusters
    1291             process_sigaction( process , BLOCK_ALL_THREADS );
    1292 
    1293             // remove TXT ownership to target process
    1294             process_txt_reset_ownership( XPTR( local_cxy , process ) );
    1295         }
    1296         break;
    1297         case SIGCONT:     // unblock all threads in all clusters
    1298         {
    1299             process_sigaction( process , UNBLOCK_ALL_THREADS );
    1300         }
    1301         break;
    1302         case SIGKILL:  // block all threads, then delete all threads
    1303         {
    1304             // block all threads in all clusters
    1305             process_sigaction( process , BLOCK_ALL_THREADS );
    1306 
    1307             // remove TXT ownership to target process
    1308             process_txt_reset_ownership( XPTR( local_cxy , process ) );
    1309 
    1310             // delete all threads (but the calling thread)
    1311             process_sigaction( process , DELETE_ALL_THREADS );
    1312 
    1313             // delete the calling thread if required
    1314             if( CURRENT_THREAD->process == process )
    1315             {
    1316                 // set REQ_DELETE flag
    1317                 hal_atomic_or( &this->flags , THREAD_FLAG_REQ_DELETE );
    1318 
    1319                 // deschedule
    1320                 sched_yield( "suicide after kill" );
    1321             }
    1322         }
    1323         break;
    1324     }
    1325 
    1326 kill_dmsg("\n[DBG] %s : core[%x,%d] exit / process %x / sig %d \n",
    1327 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, pid , sig_id );
     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
     1365uint32_t cycle = (uint32_t)hal_get_cycles();
     1366if( CONFIG_DEBUG_PROCESS_MAKE_KILL < cycle )
     1367printk("\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
     1402cycle = (uint32_t)hal_get_cycles();
     1403if( CONFIG_DEBUG_PROCESS_MAKE_KILL < cycle )
     1404printk("\n[DBG] %s : thread %x exit for process %x / cycle %d\n",
     1405__FUNCTION__, this, process->pid , cycle );
     1406#endif
    13281407
    13291408}  // end process_make_kill()
    1330 
    1331 /////////////////////////////////////////
    1332 void process_make_exit( pid_t       pid,
    1333                         uint32_t    status )
    1334 {
    1335     // this function must be executed by a thread running in owner cluster
    1336     assert( (CXY_FROM_PID( pid ) == local_cxy) , __FUNCTION__ ,
    1337     "must execute in owner cluster" );
    1338 
    1339     // get pointer on local process descriptor
    1340     process_t * process = process_get_local_copy( pid );
    1341 
    1342     // does nothing if process does not exist
    1343     if( process == NULL )
    1344     {
    1345         printk("\n[WARNING] %s : process %x does not exist => do nothing\n",
    1346         __FUNCTION__ , pid );
    1347         return;
    1348     }
    1349 
    1350     // block all threads in all clusters (but the calling thread)
    1351     process_sigaction( process , BLOCK_ALL_THREADS );
    1352 
    1353     // delete all threads in all clusters (but the calling thread)
    1354     process_sigaction( process , DELETE_ALL_THREADS );
    1355 
    1356     // delete the calling thread
    1357     hal_atomic_or( &CURRENT_THREAD->flags , THREAD_FLAG_REQ_DELETE );
    1358 
    1359     // deschedule
    1360     sched_yield( "suicide after exit" );
    1361 
    1362 }  // end process_make_exit()
    13631409
    13641410///////////////////////////////////////////////
     
    13661412{
    13671413
    1368 process_dmsg("\n[DBG] %s : core[%x,%d] enter at cycle %d\n",
    1369 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, (uint32_t)hal_get_cycles() );
     1414#if CONFIG_DEBUG_PROCESS_ZERO_CREATE
     1415uint32_t cycle = (uint32_t)hal_get_cycles();
     1416if( CONFIG_DEBUG_PROCESS_ZERO_CREATE < cycle )
     1417printk("\n[DBG] %s : thread %x enter / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     1418#endif
    13701419
    13711420    // initialize PID, REF_XP, PARENT_XP, and STATE
    1372     process->pid       = 0;
    1373     process->ref_xp    = XPTR( local_cxy , process );
    1374     process->parent_xp = XPTR_NULL;
    1375     process->state     = PROCESS_STATE_RUNNING;
     1421    process->pid        = 0;
     1422    process->ref_xp     = XPTR( local_cxy , process );
     1423    process->parent_xp  = XPTR_NULL;
     1424    process->term_state = 0;
    13761425
    13771426    // reset th_tbl[] array as empty
     
    13911440        hal_fence();
    13921441
    1393 process_dmsg("\n[DBG] %s : core[%x,%d] exit at cycle %d\n",
    1394 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , (uint32_t)hal_get_cycles() );
     1442#if CONFIG_DEBUG_PROCESS_ZERO_CREATE
     1443cycle = (uint32_t)hal_get_cycles();
     1444if( CONFIG_DEBUG_PROCESS_ZERO_CREATE < cycle )
     1445printk("\n[DBG] %s : thread %x exit / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     1446#endif
    13951447
    13961448}  // end process_zero_init()
     
    14061458    error_t          error;
    14071459
    1408 process_dmsg("\n[DBG] %s :  core[%x,%d] enters at cycle %d\n",
    1409 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid );
     1460#if CONFIG_DEBUG_PROCESS_INIT_CREATE
     1461uint32_t cycle = (uint32_t)hal_get_cycles();
     1462if( CONFIG_DEBUG_PROCESS_INIT_CREATE < cycle )
     1463printk("\n[DBG] %s : thread %x enter / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     1464#endif
    14101465
    14111466    // allocates memory for process descriptor from local cluster
     
    14341489                            XPTR( local_cxy , &process_zero ),     // parent
    14351490                            XPTR( local_cxy , &process_zero ) );   // model
    1436 
    1437 process_dmsg("\n[DBG] %s : core[%x,%d] / initialisation done\n",
    1438 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid );
    14391491
    14401492    // register "code" and "data" vsegs as well as entry-point
     
    14461498        process_destroy( process );
    14471499        }
    1448 
    1449 process_dmsg("\n[DBG] %s : core[%x,%d] vsegs registered / path = %s\n",
    1450 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, CONFIG_PROCESS_INIT_PATH );
    14511500
    14521501    // get extended pointers on process_zero children_root, children_lock
     
    14891538    hal_fence();
    14901539
    1491 process_dmsg("\n[DBG] %s : core[%x,%d] exit / main thread = %x\n",
    1492 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, thread );
     1540#if CONFIG_DEBUG_PROCESS_INIT_CREATE
     1541cycle = (uint32_t)hal_get_cycles();
     1542if( CONFIG_DEBUG_PROCESS_INIT_CREATE < cycle )
     1543printk("\n[DBG] %s : thread %x exit / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     1544#endif
    14931545
    14941546}  // end process_init_create()
    1495 
    1496 //////////////////////////////////////////
    1497 char * process_state_str( uint32_t state )
    1498 {
    1499     if     ( state == PROCESS_STATE_RUNNING ) return "RUNNING";
    1500     else if( state == PROCESS_STATE_KILLED  ) return "KILLED";
    1501     else if( state == PROCESS_STATE_EXITED  ) return "EXITED";
    1502     else                                      return "undefined";
    1503 }
    15041547
    15051548/////////////////////////////////////////
     
    15421585    // get PID and state
    15431586    pid   = hal_remote_lw( XPTR( process_cxy , &process_ptr->pid ) );
    1544     state = hal_remote_lw( XPTR( process_cxy , &process_ptr->state ) );
     1587    state = hal_remote_lw( XPTR( process_cxy , &process_ptr->term_state ) );
    15451588
    15461589    // get PPID
     
    15771620    if( owner_xp == process_xp )
    15781621    {
    1579         printk("PID %X | PPID %X | %s\t| %s (FG) | %X | %d | %s\n",
    1580         pid, ppid, process_state_str(state), txt_name, process_ptr, th_nr, elf_name );
     1622        printk("PID %X | PPID %X | STS %X | %s (FG) | %X | %d | %s\n",
     1623        pid, ppid, state, txt_name, process_ptr, th_nr, elf_name );
    15811624    }
    15821625    else
    15831626    {
    1584         printk("PID %X | PPID %X | %s\t| %s (BG) | %X | %d | %s\n",
    1585         pid, ppid, process_state_str(state), txt_name, process_ptr, th_nr, elf_name );
     1627        printk("PID %X | PPID %X | STS %X | %s (BG) | %X | %d | %s\n",
     1628        pid, ppid, state, txt_name, process_ptr, th_nr, elf_name );
    15861629    }
    15871630}  // end process_display()
     
    16321675    xptr_t      lock_xp;      // extended pointer on list lock in chdev
    16331676
    1634 process_dmsg("\n[DBG] %s : core[%x,%d] enter for process %x at cycle\n",
    1635 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid, (uint32_t)hal_get_cycles() );
     1677#if CONFIG_DEBUG_PROCESS_TXT_ATTACH
     1678uint32_t cycle = (uint32_t)hal_get_cycles();
     1679if( CONFIG_DEBUG_PROCESS_TXT_ATTACH < cycle )
     1680printk("\n[DBG] %s : thread %x enter for process %x / txt_id = %d  / cycle %d\n",
     1681__FUNCTION__, CURRENT_THREAD, process->pid, txt_id, cycle );
     1682#endif
    16361683
    16371684    // check process is reference
     
    16571704    remote_spinlock_unlock( lock_xp );
    16581705
    1659 process_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x at cycle\n",
    1660 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid, (uint32_t)hal_get_cycles() );
     1706#if CONFIG_DEBUG_PROCESS_TXT_ATTACH
     1707cycle = (uint32_t)hal_get_cycles();
     1708if( CONFIG_DEBUG_PROCESS_TXT_ATTACH < cycle )
     1709printk("\n[DBG] %s : thread %x exit for process %x / txt_id = %d / cycle %d\n",
     1710__FUNCTION__, CURRENT_THREAD, process->pid, txt_id , cycle );
     1711#endif
    16611712
    16621713} // end process_txt_attach()
     
    16701721    xptr_t      lock_xp;      // extended pointer on list lock in chdev
    16711722
    1672 process_dmsg("\n[DBG] %s : core[%x,%d] enter for process %x at cycle\n",
    1673 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid, (uint32_t)hal_get_cycles() );
     1723#if CONFIG_DEBUG_PROCESS_TXT_DETACH
     1724uint32_t cycle = (uint32_t)hal_get_cycles();
     1725if( CONFIG_DEBUG_PROCESS_TXT_DETACH < cycle )
     1726printk("\n[DBG] %s : thread %x enter for process %x / cycle %d\n",
     1727__FUNCTION__, CURRENT_THREAD, process->pid , cycle );
     1728#endif
    16741729
    16751730    // check process is reference
     
    16901745    remote_spinlock_unlock( lock_xp );
    16911746   
    1692 process_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x at cycle %d\n",
    1693 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, process->pid, (uint32_t)hal_get_cycles() );
     1747#if CONFIG_DEBUG_PROCESS_TXT_DETACH
     1748cycle = (uint32_t)hal_get_cycles();
     1749if( CONFIG_DEBUG_PROCESS_TXT_DETACH < cycle )
     1750printk("\n[DBG] %s : thread %x exit for process %x / cycle %d\n",
     1751__FUNCTION__, CURRENT_THREAD, process->pid, cycle );
     1752#endif
    16941753
    16951754} // end process_txt_detach()
     
    17321791    xptr_t      file_xp;         // extended pointer on TXT_RX pseudo file
    17331792    xptr_t      txt_xp;          // extended pointer on TXT_RX chdev
    1734     chdev_t   * txt_ptr;
    1735     cxy_t       txt_cxy;
     1793    chdev_t   * txt_ptr;         // local pointer on TXT_RX chdev
     1794    cxy_t       txt_cxy;         // cluster of TXT_RX chdev
     1795    uint32_t    txt_id;          // TXT_RX channel
    17361796    xptr_t      owner_xp;        // extended pointer on current TXT_RX owner
    17371797    xptr_t      root_xp;         // extended pointer on root of attached process list
    17381798    xptr_t      iter_xp;         // iterator for xlist
    17391799    xptr_t      current_xp;      // extended pointer on current process
    1740     process_t * current_ptr;
    1741     cxy_t       current_cxy;
    1742     pid_t       ppid;
     1800    process_t * current_ptr;     // local pointer on current process
     1801    cxy_t       current_cxy;     // cluster for current process
     1802    pid_t       ppid;            // parent process identifier for current process
    17431803
    17441804    // get cluster and local pointer on process
     
    17521812    txt_xp  = chdev_from_file( file_xp );
    17531813    txt_cxy = GET_CXY( txt_xp );
    1754     txt_ptr = (chdev_t *)GET_PTR( txt_xp );
    1755 
    1756     // get extended pointer on TXT_RX owner
     1814    txt_ptr = GET_PTR( txt_xp );
     1815
     1816    // get extended pointer on TXT_RX owner and TXT channel
    17571817    owner_xp = hal_remote_lwd( XPTR( txt_cxy , &txt_ptr->ext.txt.owner_xp ) );
     1818    txt_id   = hal_remote_lw ( XPTR( txt_cxy , &txt_ptr->channel ) );
    17581819
    17591820    // transfer ownership to KSH if required
    1760     if( owner_xp == process_xp )   
     1821    if( (owner_xp == process_xp) && (txt_id > 0) )   
    17611822    {
    17621823        // get extended pointer on root of list of attached processes
     
    17821843            }
    17831844        }
    1784     }
    1785 
    1786     assert( false , __FUNCTION__ , "KSH process not found" );
    1787 
     1845
     1846        assert( false , __FUNCTION__ , "KSH process not found" );
     1847    }
    17881848}  // end process_txt_reset_ownership()
    17891849
Note: See TracChangeset for help on using the changeset viewer.