Changeset 441 for trunk/kernel/kern


Ignore:
Timestamp:
May 9, 2018, 3:13:56 PM (7 years ago)
Author:
alain
Message:

Fix a bug in rpc_vmm_get_pte_client() function (bad RPC index).

Location:
trunk/kernel/kern
Files:
3 edited

Legend:

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

    r440 r441  
    11651165cycle = (uint32_t)hal_get_cycles();
    11661166if( DEBUG_PROCESS_MAKE_FORK < cycle )
    1167 printk("\n[DBG] %s : thread %x created child thread %x / cycle %d\n",
    1168 __FUNCTION__ , CURRENT_THREAD, thread, cycle );
     1167printk("\n[DBG] %s : thread %x created child thread %x on core[%x,%d] / cycle %d\n",
     1168__FUNCTION__ , CURRENT_THREAD, thread, local_cxy, thread->core->lid, cycle );
    11691169#endif
    11701170
     
    12221222{
    12231223    char           * path;                    // pathname to .elf file
    1224     pid_t            pid;                     // old_process PID / given to new_process
     1224    pid_t            pid;                     // old_process PID, given to new_process
    12251225    pid_t            temp_pid;                // temporary PID / given to old_process
    12261226    process_t      * old_process;             // local pointer on old process
     
    12311231    pthread_attr_t   attr;                    // new thread attributes
    12321232    lid_t            lid;                     // selected core local index
    1233         error_t          error;
    1234 
     1233        error_t          error;                   // value returned by called functions
     1234   
    12351235    // get old_thread / old_process / PID / parent_xp
    12361236    old_thread  = CURRENT_THREAD;
     
    12401240   
    12411241        // get .elf pathname from exec_info
    1242         path     = exec_info->path;
     1242        path        = exec_info->path;
    12431243
    12441244    // this function must be executed by a thread running in owner cluster
     
    12611261    if( new_process == NULL )
    12621262    {
    1263         printk("\n[ERROR] in %s : cannot allocate process descriptor in cluster %x\n",
    1264         __FUNCTION__ , local_cxy );
     1263        printk("\n[ERROR] in %s : cannot allocate process for %s\n", __FUNCTION__ , path );
    12651264        return -1;
    12661265    }
     
    12971296    // register code & data vsegs as well as entry-point in new process VMM,
    12981297    // and register extended pointer on .elf file in process descriptor
    1299         if( elf_load_process( path , new_process ) )
     1298        error = elf_load_process( path , new_process );
     1299
     1300    if( error )
    13001301        {
    1301                 printk("\n[ERROR] in %s : failed to access .elf file for path %s\n",
    1302                 __FUNCTION__ , path );
     1302                printk("\n[ERROR] in %s : failed to access <%s>\n", __FUNCTION__ , path );
     1303        process_txt_set_ownership( XPTR( local_cxy , old_process) );
     1304        process_txt_detach( XPTR( local_cxy , new_process) );
    13031305        process_destroy( new_process );
     1306        old_process->pid = pid;
    13041307        return -1;
    13051308        }
     
    13281331        if( error )
    13291332        {
    1330                 printk("\n[ERROR] in %s : cannot create thread for process %x\n",
    1331             __FUNCTION__ , new_process );
     1333                printk("\n[ERROR] in %s : cannot create thread for %s\n", __FUNCTION__ , path );
     1334        process_txt_set_ownership( XPTR( local_cxy , old_process) );
     1335        process_txt_detach( XPTR( local_cxy , new_process) );
    13321336        process_destroy( new_process );
     1337        old_process->pid = pid;
    13331338        return -1;
    13341339        }
     
    13751380cycle = (uint32_t)hal_get_cycles();
    13761381if( DEBUG_PROCESS_MAKE_EXEC < cycle )
    1377 printk("\n[DBG] %s : old_thread %x blocked / new_thread %x activated / cycle %d\n",
     1382printk("\n[DBG] %s : old thread %x blocked for delete / new thread %x activated / cycle %d\n",
    13781383__FUNCTION__ , old_thread , new_thread , cycle );
    13791384#endif
     
    17351740    remote_spinlock_unlock( lock_xp );
    17361741
    1737 #if( DEBUG_PROCESS_TXT_ATTACH & 1 )
     1742#if DEBUG_PROCESS_TXT_ATTACH
     1743cycle  = (uint32_t)hal_get_cycles();
     1744uint32_t txt_id = hal_remote_lw( XPTR( chdev_cxy , &chdev_ptr->channel ) );
    17381745if( DEBUG_PROCESS_TXT_ATTACH < cycle )
    1739 {
    1740     xptr_t root_xp = XPTR( chdev_cxy , &chdev_ptr->ext.txt.root );
    1741     xptr_t iter_xp;
    1742     XLIST_FOREACH( root_xp , iter_xp )
    1743     {
    1744         xptr_t      current_xp  = XLIST_ELEMENT( iter_xp , process_t , txt_list );
    1745         process_t * current_ptr = GET_PTR( current_xp );
    1746 
    1747         printk("\n[DBG] %s : attached_process %x (pid = %x)\n",
    1748         __FUNCTION__, current_ptr, current_ptr->pid );
    1749     }
    1750 }
    1751 #endif
    1752 
    1753 #if DEBUG_PROCESS_TXT_ATTACH
    1754 cycle = (uint32_t)hal_get_cycles();
    1755 if( DEBUG_PROCESS_TXT_ATTACH < cycle )
    1756 printk("\n[DBG] %s : thread %x exit / process %x detached from TXT / cycle %d\n",
    1757 __FUNCTION__, CURRENT_THREAD, process->pid, cycle );
     1746printk("\n[DBG] %s : thread %x exit / process %x detached from TXT %d / cycle %d\n",
     1747__FUNCTION__, CURRENT_THREAD, process_pid, txt_id, cycle );
    17581748#endif
    17591749
     
    18421832uint32_t cycle = (uint32_t)hal_get_cycles();
    18431833if( DEBUG_PROCESS_TXT_ATTACH < cycle )
    1844 printk("\n[DBG] %s : thread %x enter / process %x / pid %x / cycle %d\n",
    1845 __FUNCTION__, CURRENT_THREAD, process_ptr, process_pid, cycle );
     1834printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n",
     1835__FUNCTION__, CURRENT_THREAD, process_pid, cycle );
    18461836#endif
    18471837
  • trunk/kernel/kern/process.h

    r440 r441  
    510510 * It is called only by the process_reference_init() function when creating a KSH process.
    511511 * It makes a kernel panic if no free TXT terminal is found.
    512  * As a KSH process is never deleted, the allocated TXT terminal is never released.
     512 * The allocated TXT terminal is only released if the KSH process is deleted,
     513 * which is a rare and abnormal event.
    513514 *********************************************************************************************
    514515 * @ return TXT terminal index if succes / kernel panic if no terminal found.
  • trunk/kernel/kern/rpc.c

    r440 r441  
    16661666
    16671667/////////////////////////////////////////////////////////////////////////////////////////
    1668 // [21]          Marshaling functions attached to RPC_VMM_GET_VSEG  (blocking)
     1668// [21]          Marshaling functions attached to RPC_VMM_GET_PTE  (blocking)
    16691669/////////////////////////////////////////////////////////////////////////////////////////
    16701670
     
    16891689    // initialise RPC descriptor header
    16901690    rpc_desc_t  rpc;
    1691     rpc.index    = RPC_VMM_GET_VSEG;
     1691    rpc.index    = RPC_VMM_GET_PTE;
    16921692    rpc.blocking = true;
    16931693    rpc.responses = 1;
     
    17691769    // initialise RPC descriptor header
    17701770    rpc_desc_t  rpc;
    1771     rpc.index    = RPC_THREAD_USER_CREATE;
     1771    rpc.index    = RPC_KCM_ALLOC;
    17721772    rpc.blocking = true;
    17731773    rpc.responses = 1;
     
    18191819    // initialise RPC descriptor header
    18201820    rpc_desc_t  rpc;
    1821     rpc.index    = RPC_THREAD_USER_CREATE;
     1821    rpc.index    = RPC_KCM_FREE;
    18221822    rpc.blocking = true;
    18231823    rpc.responses = 1;
Note: See TracChangeset for help on using the changeset viewer.