Ignore:
Timestamp:
Dec 27, 2018, 7:38:58 PM (5 years ago)
Author:
alain
Message:

Fix several bugs in VFS to support the following
ksh commandis : cp, mv, rm, mkdir, cd, pwd

File:
1 edited

Legend:

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

    r593 r610  
    9595                             xptr_t      parent_xp )
    9696{
     97    xptr_t      process_xp;
    9798    cxy_t       parent_cxy;
    9899    process_t * parent_ptr;
     
    113114    pid_t       parent_pid;
    114115
     116    // build extended pointer on this reference process
     117    process_xp = XPTR( local_cxy , process );
     118
    115119    // get parent process cluster and local pointer
    116120    parent_cxy = GET_CXY( parent_xp );
     
    121125
    122126#if DEBUG_PROCESS_REFERENCE_INIT
     127thread_t * this = CURRENT_THREAD;
    123128uint32_t cycle = (uint32_t)hal_get_cycles();
    124 if( DEBUG_PROCESS_REFERENCE_INIT )
    125 printk("\n[%s] thread %x in process %x enter to initalialize process %x / cycle %d\n",
    126 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid , pid , cycle );
    127 #endif
    128 
    129     // initialize PID, REF_XP, PARENT_XP, and STATE
     129if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     130printk("\n[%s] thread[%x,%x] enter to initalialize process %x / cycle %d\n",
     131__FUNCTION__, parent_pid, this->trdid, pid, cycle );
     132#endif
     133
     134    // initialize pid, ref_xp, parent_xp, owner_xp, term_state fields
    130135        process->pid        = pid;
    131136    process->ref_xp     = XPTR( local_cxy , process );
     
    134139    process->term_state = 0;
    135140
     141    // initialize VFS root inode and CWD inode
     142    process->vfs_root_xp = hal_remote_l64( XPTR( parent_cxy, &parent_ptr->vfs_root_xp ) );
     143    process->cwd_xp      = hal_remote_l64( XPTR( parent_cxy, &parent_ptr->cwd_xp ) );
     144
    136145    // initialize vmm as empty
    137146    error = vmm_init( process );
     
    141150#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    142151cycle = (uint32_t)hal_get_cycles();
    143 if( DEBUG_PROCESS_REFERENCE_INIT )
    144 printk("\n[%s] thread %x in process %x / vmm empty for process %x / cycle %d\n",
    145 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid , pid, cycle );
     152if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     153printk("\n[%s] thread[%x,%x] / vmm empty for process %x / cycle %d\n",
     154__FUNCTION__, parent_pid, this->trdid, pid, cycle );
    146155#endif
    147156
     
    161170#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    162171cycle = (uint32_t)hal_get_cycles();
    163 if( DEBUG_PROCESS_REFERENCE_INIT )
    164 printk("\n[%s] thread %x in process %x / process %x attached to TXT%d / cycle %d\n",
    165 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid, pid, txt_id, cycle );
     172if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     173printk("\n[%s] thread[%x,%x] / process %x attached to TXT%d / cycle %d\n",
     174__FUNCTION__, parent_pid, this->trdid, pid, txt_id, cycle );
    166175#endif
    167176        // build path to TXT_RX[i] and TXT_TX[i] chdevs
     
    170179
    171180        // create stdin pseudo file         
    172         error = vfs_open( process,
     181        error = vfs_open(  process->vfs_root_xp,
    173182                           rx_path,
     183                           process_xp,
    174184                           O_RDONLY,
    175185                           0,                // FIXME chmod
     
    182192#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    183193cycle = (uint32_t)hal_get_cycles();
    184 if( DEBUG_PROCESS_REFERENCE_INIT )
    185 printk("\n[%s] thread %x in process %x / stdin open for process %x / cycle %d\n",
    186 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid, pid, cycle );
     194if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     195printk("\n[%s] thread[%x,%x] / stdin open for process %x / cycle %d\n",
     196__FUNCTION__, parent_pid, this->trdid, pid, cycle );
    187197#endif
    188198
    189199        // create stdout pseudo file         
    190         error = vfs_open( process,
     200        error = vfs_open(  process->vfs_root_xp,
    191201                           tx_path,
     202                           process_xp,
    192203                           O_WRONLY,
    193204                           0,                // FIXME chmod
     
    200211#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    201212cycle = (uint32_t)hal_get_cycles();
    202 if( DEBUG_PROCESS_REFERENCE_INIT )
    203 printk("\n[%s] thread %x in process %x / stdout open for process %x / cycle %d\n",
    204 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid, pid, cycle );
     213if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     214printk("\n[%s] thread[%x,%x] / stdout open for process %x / cycle %d\n",
     215__FUNCTION__, parent_pid, this->trdid, pid, cycle );
    205216#endif
    206217
    207218        // create stderr pseudo file         
    208         error = vfs_open( process,
     219        error = vfs_open(  process->vfs_root_xp,
    209220                           tx_path,
     221                           process_xp,
    210222                           O_WRONLY,
    211223                           0,                // FIXME chmod
     
    218230#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    219231cycle = (uint32_t)hal_get_cycles();
    220 if( DEBUG_PROCESS_REFERENCE_INIT )
    221 printk("\n[%s] thread %x in process %x / stderr open for process %x / cycle %d\n",
    222 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid, pid, cycle );
     232if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     233printk("\n[%s] thread[%x,%x] / stderr open for process %x / cycle %d\n",
     234__FUNCTION__, parent_pid, this->trdid, pid, cycle );
    223235#endif
    224236
     
    247259    }
    248260
    249     // initialize specific inodes root and cwd
    250     process->vfs_root_xp = (xptr_t)hal_remote_l64( XPTR( parent_cxy,
    251                                                          &parent_ptr->vfs_root_xp ) );
    252     process->vfs_cwd_xp  = (xptr_t)hal_remote_l64( XPTR( parent_cxy,
    253                                                          &parent_ptr->vfs_cwd_xp ) );
    254     vfs_inode_remote_up( process->vfs_root_xp );
    255     vfs_inode_remote_up( process->vfs_cwd_xp );
    256 
    257     remote_rwlock_init( XPTR( local_cxy , &process->cwd_lock ), LOCK_PROCESS_CWD );
     261    // initialize lock protecting CWD changes
     262    remote_busylock_init( XPTR( local_cxy , &process->cwd_lock ), LOCK_PROCESS_CWD );
    258263
    259264#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    260265cycle = (uint32_t)hal_get_cycles();
    261 if( DEBUG_PROCESS_REFERENCE_INIT )
    262 printk("\n[%s] thread %x in process %x / set fd_array for process %x / cycle %d\n",
    263 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid, pid , cycle );
     266if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     267printk("\n[%s] thread[%x,%x] / set fd_array for process %x / cycle %d\n",
     268__FUNCTION__, parent_pid, this->trdid, pid , cycle );
    264269#endif
    265270
     
    300305#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
    301306cycle = (uint32_t)hal_get_cycles();
    302 if( DEBUG_PROCESS_REFERENCE_INIT )
    303 printk("\n[%s] thread %x in process %x exit for process %x / cycle %d\n",
    304 __FUNCTION__, CURRENT_THREAD->trdid, parent_pid, pid, cycle );
     307if( DEBUG_PROCESS_REFERENCE_INIT < cycle )
     308printk("\n[%s] thread[%x,%x] exit for process %x / cycle %d\n",
     309__FUNCTION__, parent_pid, this->trdid, pid, cycle );
    305310#endif
    306311
     
    325330
    326331#if DEBUG_PROCESS_COPY_INIT
    327 thread_t * this = CURRET_THREAD; 
     332thread_t * this = CURRENT_THREAD; 
    328333uint32_t cycle = (uint32_t)hal_get_cycles();
    329 if( DEBUG_PROCESS_COPY_INIT )
    330 printk("\n[%s] thread %x in process %x enter for process %x / cycle %d\n",
    331 __FUNCTION__, this->trdid, this->process->pid, local_process->pid, cycle );
     334if( DEBUG_PROCESS_COPY_INIT < cycle )
     335printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n",
     336__FUNCTION__, this->process->pid, this->trdid, local_process->pid, cycle );
    332337#endif
    333338
     
    342347        process_fd_init( local_process );
    343348
    344     // reset vfs_root_xp / vfs_bin_xp / vfs_cwd_xp fields
     349    // reset vfs_root_xp / vfs_bin_xp / cwd_xp fields
    345350    local_process->vfs_root_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_root_xp ) );
    346351    local_process->vfs_bin_xp  = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_bin_xp ) );
    347     local_process->vfs_cwd_xp  = XPTR_NULL;
     352    local_process->cwd_xp      = XPTR_NULL;
    348353
    349354    // reset children list root (not used in a process descriptor copy)
     
    382387#if DEBUG_PROCESS_COPY_INIT
    383388cycle = (uint32_t)hal_get_cycles();
    384 if( DEBUG_PROCESS_COPY_INIT )
    385 printk("\n[%s] thread %x in process %x exit for process %x / cycle %d\n",
    386 __FUNCTION__, this->trdid, this->process->pid, local_process->pid, cycle );
     389if( DEBUG_PROCESS_COPY_INIT < cycle )
     390printk("\n[%s] thread[%x,%x] exit for process %x / cycle %d\n",
     391__FUNCTION__, this->process->pid, this->trdid, local_process->pid, cycle );
    387392#endif
    388393
     
    406411
    407412#if DEBUG_PROCESS_DESTROY
     413thread_t * this = CURRENT_THREAD;
    408414uint32_t cycle = (uint32_t)hal_get_cycles();
    409 if( DEBUG_PROCESS_DESTROY )
    410 printk("\n[%s] thread %x in process %x enter for process %x in cluster %x / cycle %d\n",
    411 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, pid, local_cxy, cycle );
     415if( DEBUG_PROCESS_DESTROY < cycle )
     416printk("\n[%s] thread[%x,%x] enter for process %x in cluster %x / cycle %d\n",
     417__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy, cycle );
    412418#endif
    413419
     
    446452        if( process->vfs_bin_xp  != XPTR_NULL ) vfs_file_count_down( process->vfs_bin_xp );
    447453        if( process->vfs_root_xp != XPTR_NULL ) vfs_file_count_down( process->vfs_root_xp );
    448         if( process->vfs_cwd_xp  != XPTR_NULL ) vfs_file_count_down( process->vfs_cwd_xp );
     454        if( process->cwd_xp      != XPTR_NULL ) vfs_file_count_down( process->cwd_xp );
    449455
    450456    // Destroy VMM
     
    456462#if DEBUG_PROCESS_DESTROY
    457463cycle = (uint32_t)hal_get_cycles();
    458 if( DEBUG_PROCESS_DESTROY )
    459 printk("\n[%s] thread %x in process %x exit / process %x in cluster %x / cycle %d\n",
    460 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, pid, local_cxy, cycle );
     464if( DEBUG_PROCESS_DESTROY < cycle )
     465printk("\n[%s] thread[%x,%x] exit / process %x in cluster %x / cycle %d\n",
     466__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy, cycle );
    461467#endif
    462468
     
    561567        process_ptr = GET_PTR( process_xp );
    562568
    563 // printk("\n@@@ in %s : process_cxy %x / process_ptr %x / pid %x\n",
    564 // __FUNCTION__, process_cxy, process_ptr, hal_remote_l32( XPTR( process_cxy , &process_ptr->pid ) ) );
    565 
    566569        if( process_cxy == local_cxy )    // process copy is local
    567570        {
     
    652655assert( (LPID_FROM_PID( process->pid ) != 0 ), "target process must be an user process" );
    653656
    654     // get target process cluster
     657    // get target process owner cluster
    655658    owner_cxy = CXY_FROM_PID( process->pid );
    656659
     
    697700    while( 1 )
    698701    {
    699         // exit when all scheduler acknoledges received
     702        // exit when all scheduler acknowledges received
    700703        if ( ack_count == 0 ) break;
    701704   
     
    927930    uint32_t fd;
    928931
     932    // initialize lock
    929933    remote_queuelock_init( XPTR( local_cxy , &process->fd_array.lock ), LOCK_PROCESS_FDARRAY );
    930934
     935    // initialize number of open files
    931936    process->fd_array.current = 0;
    932937
     
    937942    }
    938943}
    939 /////////////////////////////////////////////////
    940 error_t process_fd_register( process_t * process,
     944////////////////////////////////////////////////////
     945error_t process_fd_register( xptr_t      process_xp,
    941946                             xptr_t      file_xp,
    942947                             uint32_t  * fdid )
     
    944949    bool_t    found;
    945950    uint32_t  id;
    946     uint32_t  count;
    947951    xptr_t    xp;
    948952
    949953    // get reference process cluster and local pointer
    950     xptr_t ref_xp = process->ref_xp;
    951     process_t * ref_ptr = GET_PTR( ref_xp );
    952     cxy_t       ref_cxy = GET_CXY( ref_xp );
     954    process_t * process_ptr = GET_PTR( process_xp );
     955    cxy_t       process_cxy = GET_CXY( process_xp );
     956
     957// check client process is reference process
     958assert( (process_xp == hal_remote_l64( XPTR( process_cxy , &process_ptr->ref_xp ) ) ),
     959"client process must be reference process\n" );
     960
     961#if DEBUG_PROCESS_FD_REGISTER
     962thread_t * this  = CURRENT_THREAD;
     963uint32_t   cycle = (uint32_t)hal_get_cycles();
     964pid_t      pid   = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid) );
     965if( DEBUG_PROCESS_FD_REGISTER < cycle )
     966printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n",
     967__FUNCTION__, this->process->pid, this->trdid, pid, cycle );
     968#endif
     969
     970    // build extended pointer on lock protecting reference fd_array
     971    xptr_t lock_xp = XPTR( process_cxy , &process_ptr->fd_array.lock );
    953972
    954973    // take lock protecting reference fd_array
    955         remote_queuelock_acquire( XPTR( ref_cxy , &ref_ptr->fd_array.lock ) );
     974        remote_queuelock_acquire( lock_xp );
    956975
    957976    found   = false;
     
    959978    for ( id = 0; id < CONFIG_PROCESS_FILE_MAX_NR ; id++ )
    960979    {
    961         xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->fd_array.array[id] ) );
     980        xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->fd_array.array[id] ) );
    962981        if ( xp == XPTR_NULL )
    963982        {
    964983            // update reference fd_array
    965             hal_remote_s64( XPTR( ref_cxy , &ref_ptr->fd_array.array[id] ) , file_xp );
    966                 count = hal_remote_l32( XPTR( ref_cxy , &ref_ptr->fd_array.current ) ) + 1;
    967             hal_remote_s32( XPTR( ref_cxy , &ref_ptr->fd_array.current ) , count );
    968 
    969             // update local fd_array copy if required
    970             if( ref_cxy != local_cxy )
    971             {
    972                 process->fd_array.array[id] = file_xp;
    973                 process->fd_array.current   = count;
    974             }
     984            hal_remote_s64( XPTR( process_cxy , &process_ptr->fd_array.array[id] ) , file_xp );
     985                hal_remote_atomic_add( XPTR( process_cxy , &process_ptr->fd_array.current ) , 1 );
    975986
    976987            // exit
     
    981992    }
    982993
    983     // release lock protecting reference fd_array
    984         remote_queuelock_release( XPTR( ref_cxy , &ref_ptr->fd_array.lock ) );
     994    // release lock protecting fd_array
     995        remote_queuelock_release( lock_xp );
     996
     997#if DEBUG_PROCESS_FD_REGISTER
     998cycle = (uint32_t)hal_get_cycles();
     999if( DEBUG_PROCESS_FD_REGISTER < cycle )
     1000printk("\n[%s] thread[%x,%x] exit for process %x / fdid %d / cycle %d\n",
     1001__FUNCTION__, this->process->pid, this->trdid, pid, id, cycle );
     1002#endif
    9851003
    9861004    if ( !found ) return -1;
    9871005    else          return 0;
    988 }
     1006
     1007}  // end process_fd_register()
    9891008
    9901009////////////////////////////////////////////////
     
    11191138        // returns trdid
    11201139        *trdid = TRDID( local_cxy , ltid );
    1121 
    1122 // if( LPID_FROM_PID( process->pid ) == 0 )
    1123 // printk("\n@@@ %s : allocate ltid %d for a thread %s in cluster %x\n",
    1124 // __FUNCTION__, ltid, thread_type_str( thread->type), local_cxy );
    1125 
    11261140    }
    11271141
     
    11581172    process->th_tbl[ltid] = NULL;
    11591173    process->th_nr = count-1;
    1160 
    1161 // if( LPID_FROM_PID( process->pid ) == 0 )
    1162 // printk("\n@@@ %s : release ltid %d for a thread %s in cluster %x\n",
    1163 // __FUNCTION__, ltid, thread_type_str( thread->type), local_cxy );
    11641174
    11651175    // release lock protecting th_tbl
     
    13631373    process_t      * process;                 // local pointer on this process
    13641374    pid_t            pid;                     // this process identifier
     1375    xptr_t           ref_xp;                  // reference process for this process
    13651376        error_t          error;                   // value returned by called functions
    13661377    char           * path;                    // path to .elf file
     
    13701381    char          ** args_pointers;           // array of pointers on main thread arguments
    13711382
    1372     // get thread, process & PID
     1383    // get thread, process, pid and ref_xp
    13731384    thread  = CURRENT_THREAD;
    13741385    process = thread->process;
    13751386    pid     = process->pid;
     1387    ref_xp  = process->ref_xp;
    13761388
    13771389        // get relevant infos from exec_info
     
    13901402    file_xp = XPTR_NULL;
    13911403    file_id = 0xFFFFFFFF;
    1392         error   = vfs_open( process,
     1404        error   = vfs_open( process->vfs_root_xp,
    13931405                            path,
     1406                        ref_xp,
    13941407                            O_RDONLY,
    13951408                            0,
     
    15431556#endif
    15441557
    1545 }  // end process_zero_init()
     1558}  // end process_zero_create()
    15461559
    15471560////////////////////////////////
     
    15581571
    15591572#if DEBUG_PROCESS_INIT_CREATE
     1573thread_t * this = CURRENT_THREAD;
    15601574uint32_t cycle = (uint32_t)hal_get_cycles();
    15611575if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1562 printk("\n[%s] thread %x in process %x enter / cycle %d\n",
    1563 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, cycle );
     1576printk("\n[%s] thread[%x,%x] enter / cycle %d\n",
     1577__FUNCTION__, this->process->pid, this->trdid, cycle );
    15641578#endif
    15651579
     
    15711585"no memory for process descriptor in cluster %x\n", local_cxy  );
    15721586
     1587    // set the CWD and VFS_ROOT fields in process descriptor
     1588    process->cwd_xp      = process_zero.vfs_root_xp;
     1589    process->vfs_root_xp = process_zero.vfs_root_xp;
     1590
    15731591    // get PID from local cluster
    15741592    error = cluster_pid_alloc( process , &pid );
     
    15891607#if(DEBUG_PROCESS_INIT_CREATE & 1)
    15901608if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1591 printk("\n[%s] thread %x in process %x initialized process descriptor\n",
    1592 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid );
     1609printk("\n[%s] thread[%x,%x] initialized process descriptor\n",
     1610__FUNCTION__, this->process->pid, this->trdid );
    15931611#endif
    15941612
     
    15961614    file_xp = XPTR_NULL;
    15971615    file_id = -1;
    1598         error   = vfs_open( process,
     1616        error   = vfs_open( process->vfs_root_xp,
    15991617                            CONFIG_PROCESS_INIT_PATH,
     1618                        XPTR( local_cxy , process ),
    16001619                            O_RDONLY,
    16011620                            0,
     
    16081627#if(DEBUG_PROCESS_INIT_CREATE & 1)
    16091628if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1610 printk("\n[%s] thread %x in process %x open .elf file decriptor\n",
    1611 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid );
     1629printk("\n[%s] thread[%x,%x] open .elf file decriptor\n",
     1630__FUNCTION__, this->process->pid, this->trdid );
    16121631#endif
    16131632
     
    16211640#if(DEBUG_PROCESS_INIT_CREATE & 1)
    16221641if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1623 printk("\n[%s] thread %x in process %x registered code/data vsegs in VMM\n",
    1624 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid );
     1642printk("\n[%s] thread[%x,%x] registered code/data vsegs in VMM\n",
     1643__FUNCTION__, this->process->pid, this->trdid );
    16251644#endif
    16261645
     
    16411660#if(DEBUG_PROCESS_INIT_CREATE & 1)
    16421661if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1643 printk("\n[%s] thread %x in process %x registered init process in parent\n",
    1644 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid );
     1662printk("\n[%s] thread[%x,%x] registered init process in parent\n",
     1663__FUNCTION__, this->process->pid, this->trdid );
    16451664#endif
    16461665
     
    16681687#if(DEBUG_PROCESS_INIT_CREATE & 1)
    16691688if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1670 printk("\n[%s] thread %x in process %x created main thread\n",
    1671 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid );
     1689printk("\n[%s] thread[%x,%x] created main thread\n",
     1690__FUNCTION__, this->process->pid, this->trdid );
    16721691#endif
    16731692
     
    16801699cycle = (uint32_t)hal_get_cycles();
    16811700if( DEBUG_PROCESS_INIT_CREATE < cycle )
    1682 printk("\n[%s] thread %x in process %x exit / cycle %d\n",
    1683 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, cycle );
     1701printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
     1702__FUNCTION__, this->process->pid, this->trdid, cycle );
    16841703#endif
    16851704
     
    18651884
    18661885#if DEBUG_PROCESS_TXT
     1886thread_t * this = CURRENT_THREAD;
    18671887uint32_t cycle = (uint32_t)hal_get_cycles();
    18681888if( DEBUG_PROCESS_TXT < cycle )
    1869 printk("\n[%s] thread %x in process %x attached process %x to TXT %d / cycle %d\n",
    1870 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid,
    1871 process->pid, txt_id , cycle );
     1889printk("\n[%s] thread[%x,%x] attached process %x to TXT %d / cycle %d\n",
     1890__FUNCTION__, this->process->pid, this->trdid, process->pid, txt_id , cycle );
    18721891#endif
    18731892
     
    19191938
    19201939#if DEBUG_PROCESS_TXT
     1940thread_t * this = CURRENT_THREAD;
    19211941uint32_t cycle  = (uint32_t)hal_get_cycles();
    19221942uint32_t txt_id = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->channel ) );
    19231943if( DEBUG_PROCESS_TXT < cycle )
    1924 printk("\n[%s] thread %x in process %x detached process %x from TXT %d / cycle %d\n",
    1925 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid,
    1926 process_pid, txt_id, cycle );
     1944printk("\n[%s] thread[%x,%x] detached process %x from TXT %d / cycle %d\n",
     1945__FUNCTION__, this->process->pid, this->trdid, process_pid, txt_id, cycle );
    19271946#endif
    19281947
     
    19611980
    19621981#if DEBUG_PROCESS_TXT
     1982thread_t * this = CURRENT_THREAD;
    19631983uint32_t cycle  = (uint32_t)hal_get_cycles();
    19641984uint32_t txt_id = hal_remote_l32( XPTR( txt_cxy , &txt_ptr->channel ) );
    19651985if( DEBUG_PROCESS_TXT < cycle )
    1966 printk("\n[%s] thread %x in process %x give TXT %d to process %x / cycle %d\n",
    1967 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, txt_id, process_pid, cycle );
     1986printk("\n[%s] thread[%x,%x] give TXT %d to process %x / cycle %d\n",
     1987__FUNCTION__, this->process->pid, this->trdid, txt_id, process_pid, cycle );
    19681988#endif
    19691989
     
    19902010
    19912011#if DEBUG_PROCESS_TXT
    1992 uint32_t cycle;
     2012thread_t * this  = CURRENT_THREAD;
     2013uint32_t   cycle;
    19932014#endif
    19942015
     
    20422063
    20432064#if DEBUG_PROCESS_TXT
    2044 cycle   = (uint32_t)hal_get_cycles();
     2065cycle = (uint32_t)hal_get_cycles();
    20452066uint32_t ksh_pid = hal_remote_l32( XPTR( current_cxy , &current_ptr->pid ) );
    20462067if( DEBUG_PROCESS_TXT < cycle )
    2047 printk("\n[%s] thread %x in process %x release TXT %d to KSH %x / cycle %d\n",
    2048 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, txt_id, ksh_pid, cycle );
     2068printk("\n[%s] thread[%x,%x] release TXT %d to KSH %x / cycle %d\n",
     2069__FUNCTION__, this->process->pid, this->trdid, txt_id, ksh_pid, cycle );
    20492070process_txt_display( txt_id );
    20502071#endif
     
    20792100
    20802101#if DEBUG_PROCESS_TXT
    2081 cycle   = (uint32_t)hal_get_cycles();
     2102cycle  = (uint32_t)hal_get_cycles();
    20822103uint32_t new_pid = hal_remote_l32( XPTR( current_cxy , &current_ptr->pid ) );
    20832104if( DEBUG_PROCESS_TXT < cycle )
    2084 printk("\n[%s] thread %x in process %x release TXT %d to process %x / cycle %d\n",
    2085 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, txt_id, new_pid, cycle );
     2105printk("\n[%s] thread[%x,%x] release TXT %d to process %x / cycle %d\n",
     2106__FUNCTION__,this->process->pid, this->trdid, txt_id, new_pid, cycle );
    20862107process_txt_display( txt_id );
    20872108#endif
     
    20992120cycle = (uint32_t)hal_get_cycles();
    21002121if( DEBUG_PROCESS_TXT < cycle )
    2101 printk("\n[%s] thread %x in process %x release TXT %d to nobody / cycle %d\n",
    2102 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, txt_id, cycle );
     2122printk("\n[%s] thread[%x,%x] release TXT %d to nobody / cycle %d\n",
     2123__FUNCTION__, this->process->pid, this->trdid, txt_id, cycle );
    21032124process_txt_display( txt_id );
    21042125#endif
     
    21132134if( DEBUG_PROCESS_TXT < cycle )
    21142135printk("\n[%s] thread %x in process %d does nothing (not TXT owner) / cycle %d\n",
    2115 __FUNCTION__, CURRENT_THREAD->trdid, process_pid, cycle );
     2136__FUNCTION__, this->trdid, process_pid, cycle );
    21162137process_txt_display( txt_id );
    21172138#endif
Note: See TracChangeset for help on using the changeset viewer.