Changeset 580


Ignore:
Timestamp:
Oct 8, 2018, 11:31:42 AM (3 years ago)
Author:
alain
Message:

1) Register the kernel process in the cluster manager local list.
2) Introduce a new service in idbg : display the set of busylocks taken by a given thread.

Location:
trunk
Files:
17 edited

Legend:

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

    r564 r580  
    200200    cluster->pmgr.pref_nr = 0;
    201201    cluster->pmgr.pref_tbl[0] = XPTR( local_cxy , &process_zero );
    202     for( lpid = 1 ; lpid < CONFIG_MAX_PROCESS_PER_CLUSTER ; lpid++ )
     202    for( lpid = 0 ; lpid < CONFIG_MAX_PROCESS_PER_CLUSTER ; lpid++ )
    203203    {
    204204        cluster->pmgr.pref_tbl[lpid] = XPTR_NULL;
  • trunk/kernel/kern/kernel_init.c

    r577 r580  
    375375            // check channels
    376376            if( channels != 1 )
    377             printk("\n[PANIC] in %s : MMC device must be single channel\n", __FUNCTION__ );
     377            {
     378                printk("\n[PANIC] in %s : MMC device must be single channel\n",
     379                __FUNCTION__ );
     380                hal_core_sleep();
     381            }
    378382
    379383            // create chdev in local cluster
     
    386390            // check memory
    387391            if( chdev_ptr == NULL )
    388             printk("\n[PANIC] in %s : cannot create MMC chdev\n", __FUNCTION__ );
     392            {
     393                printk("\n[PANIC] in %s : cannot create MMC chdev\n",
     394                __FUNCTION__ );
     395                hal_core_sleep();
     396            }
    389397           
    390398            // make MMC specific initialisation
     
    427435                // check memory
    428436                if( chdev_ptr == NULL )
    429                 printk("\n[PANIC] in %s : cannot create DMA chdev\n", __FUNCTION__ );
     437                {
     438                    printk("\n[PANIC] in %s : cannot create DMA chdev\n",
     439                    __FUNCTION__ );
     440                    hal_core_sleep();
     441                }
    430442           
    431443                // make DMA specific initialisation
     
    503515        // check PIC device initialized
    504516        if( chdev_dir.pic == XPTR_NULL )
    505         printk("\n[PANIC] in %s : PIC device must be initialized first\n", __FUNCTION__ );
     517        {
     518            printk("\n[PANIC] in %s : PIC device must be initialized first\n",
     519            __FUNCTION__ );
     520            hal_core_sleep();
     521        }
    506522
    507523        // check external device functionnal type
    508524        if( (func != DEV_FUNC_IOB) && (func != DEV_FUNC_IOC) && (func != DEV_FUNC_TXT) &&
    509525            (func != DEV_FUNC_NIC) && (func != DEV_FUNC_FBF) )
    510         printk("\n[PANIC] in %s : undefined peripheral type\n", __FUNCTION__ );
     526        {
     527            printk("\n[PANIC] in %s : undefined peripheral type\n",
     528            __FUNCTION__ );
     529            hal_core_sleep();
     530        }
    511531
    512532        // loops on channels
     
    548568
    549569                    if( chdev == NULL )
    550                     printk("\n[PANIC] in %s : cannot allocate chdev for external device\n",
    551                     __FUNCTION__ );
     570                    {
     571                        printk("\n[PANIC] in %s : cannot allocate chdev\n",
     572                        __FUNCTION__ );
     573                        hal_core_sleep();
     574                    }
    552575
    553576                    // make device type specific initialisation
     
    646669    // check PIC existence
    647670    if( found == false )
    648     printk("\n[PANIC] in %s : PIC device not found\n", __FUNCTION__ );
     671    {
     672        printk("\n[PANIC] in %s : PIC device not found\n",
     673        __FUNCTION__ );
     674        hal_core_sleep();
     675    }
    649676
    650677    // allocate and initialize the PIC chdev in cluster 0
     
    657684    // check memory
    658685    if( chdev == NULL )
    659     printk("\n[PANIC] in %s : no memory for PIC chdev\n", __FUNCTION__ );
     686    {
     687        printk("\n[PANIC] in %s : no memory for PIC chdev\n",
     688        __FUNCTION__ );
     689        hal_core_sleep();
     690    }
    660691
    661692    // make PIC device type specific initialisation
     
    723754            else if((func == DEV_FUNC_NIC) && (is_rx != 0)) ptr = &iopic_input.nic_rx[channel];
    724755            else if( func == DEV_FUNC_IOB )                 ptr = &iopic_input.iob;
    725             else     printk("\n[PANIC] in %s : illegal source device for IOPIC input" );
     756            else
     757            {
     758                printk("\n[PANIC] in %s : illegal source device for IOPIC input\n",
     759                __FUNCTION__ );
     760                hal_core_sleep();
     761            }
    726762
    727763            // set one entry in all "iopic_input" structures
     
    814850                if     ( func == DEV_FUNC_MMC ) lapic_input.mmc = id;
    815851                else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id;
    816                 else     printk("\n[PANIC] in %s : illegal source device for LAPIC input" );
     852                else
     853                {
     854                    printk("\n[PANIC] in %s : illegal source device for LAPIC input\n",
     855                    __FUNCTION__ );
     856                    hal_core_sleep();
     857                }
    817858            }
    818859        }
     
    939980    // all cores check identifiers
    940981    if( error )
    941     printk("\n[PANIC] in %s : illegal core : gid %x / cxy %x / lid %d",
    942     __FUNCTION__, core_lid, core_cxy, core_lid );
     982    {
     983        printk("\n[PANIC] in %s : illegal core : gid %x / cxy %x / lid %d",
     984        __FUNCTION__, core_lid, core_cxy, core_lid );
     985        hal_core_sleep();
     986    }
    943987
    944988    // CP0 initializes cluster manager complex structures
     
    948992
    949993        if( error )
    950         printk("\n[PANIC] in %s : cannot initialize cluster manager in cluster %x\n",
    951         __FUNCTION__, local_cxy );
     994        {
     995             printk("\n[PANIC] in %s : cannot initialize cluster manager in cluster %x\n",
     996             __FUNCTION__, local_cxy );
     997             hal_core_sleep();
     998        }
    952999    }
    9531000
     
    10681115
    10691116            if( fatfs_ctx == NULL )
    1070             printk("\n[PANIC] in %s : cannot create FATFS context in cluster 0\n",
    1071             __FUNCTION__ );
     1117            {
     1118                printk("\n[PANIC] in %s : cannot create FATFS context in cluster 0\n",
     1119                __FUNCTION__ );
     1120                hal_core_sleep();
     1121            }
    10721122
    10731123            // 2. access boot device to initialize FATFS context
     
    10991149                                      &vfs_root_inode_xp );                // return
    11001150            if( error )
    1101             printk("\n[PANIC] in %s : cannot create VFS root inode in cluster 0\n",
    1102             __FUNCTION__ );
     1151            {
     1152                printk("\n[PANIC] in %s : cannot create VFS root inode in cluster 0\n",
     1153                __FUNCTION__ );
     1154                hal_core_sleep();
     1155            }
    11031156
    11041157            // 6. update the FATFS entry in vfs_context[] array
     
    11091162
    11101163            if( ((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster != 8 )
    1111             printk("\n[PANIC] in %s : illegal FATFS context in cluster 0\n",
    1112             __FUNCTION__ );
     1164            {
     1165                printk("\n[PANIC] in %s : illegal FATFS context in cluster 0\n",
     1166                __FUNCTION__ );
     1167                hal_core_sleep();
     1168            }
     1169               
    11131170        }
    11141171        else
     
    11161173            printk("\n[PANIC] in %s : unsupported VFS type in cluster 0\n",
    11171174            __FUNCTION__ );
     1175            hal_core_sleep();
    11181176        }
    11191177
     
    11531211            // check memory
    11541212            if( local_fatfs_ctx == NULL )
    1155             printk("\n[PANIC] in %s : cannot create FATFS context in cluster %x\n",
    1156             __FUNCTION__ , local_cxy );
     1213            {
     1214                printk("\n[PANIC] in %s : cannot create FATFS context in cluster %x\n",
     1215                __FUNCTION__ , local_cxy );
     1216                hal_core_sleep();
     1217            }
    11571218
    11581219            // 2. get local pointer on VFS context for FATFS
     
    11741235
    11751236            if( ((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster != 8 )
    1176             printk("\n[PANIC] in %s : illegal FATFS context in cluster %x\n",
    1177             __FUNCTION__ , local_cxy );
     1237            {
     1238                printk("\n[PANIC] in %s : illegal FATFS context in cluster %x\n",
     1239                __FUNCTION__ , local_cxy );
     1240                hal_core_sleep();
     1241            }
    11781242        }
    11791243
     
    12101274
    12111275        if( devfs_ctx == NULL )
    1212         printk("\n[PANIC] in %s : cannot create DEVFS context in cluster 0\n",
    1213         __FUNCTION__ , local_cxy );
     1276        {
     1277            printk("\n[PANIC] in %s : cannot create DEVFS context in cluster 0\n",
     1278            __FUNCTION__ , local_cxy );
     1279            hal_core_sleep();
     1280        }
    12141281
    12151282        // 2. initialize the DEVFS entry in the vfs_context[] array
  • trunk/kernel/kern/process.c

    r564 r580  
    112112    cxy_t       chdev_cxy;
    113113    pid_t       parent_pid;
     114    lpid_t      process_lpid;
     115    lpid_t      parent_lpid;
    114116
    115117    // get parent process cluster and local pointer
     
    119121    // get parent_pid
    120122    parent_pid = hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid ) );
     123
     124    // get process and parent lpid
     125    process_lpid = LPID_FROM_PID( pid );
     126    parent_lpid  = LPID_FROM_PID( parent_pid );
    121127
    122128#if DEBUG_PROCESS_REFERENCE_INIT
     
    150156
    151157    // define the stdin/stdout/stderr pseudo files <=> select a TXT terminal.
    152     if( (pid == 1) || (parent_pid == 1)) // INIT or KSH process
     158    if( (process_lpid == 1) ||     // INIT process
     159        (parent_lpid  == 1) )      // KSH  process
    153160    {
    154161        // allocate a TXT channel
    155         if( pid == 1 )  txt_id = 0;                     // INIT
    156         else            txt_id = process_txt_alloc();   // KSH
     162        if( process_lpid == 1 )  txt_id = 0;                     // INIT
     163        else                     txt_id = process_txt_alloc();   // KSH
    157164
    158165        // attach process to TXT
     
    14871494void process_zero_create( process_t * process )
    14881495{
     1496    error_t error;
     1497    pid_t   pid;
    14891498
    14901499#if DEBUG_PROCESS_ZERO_CREATE
     
    14951504#endif
    14961505
     1506    // get PID from local cluster manager for this kernel process
     1507    error = cluster_pid_alloc( process , &pid );
     1508
     1509    if( error || (LPID_FROM_PID( pid ) != 0) )
     1510    {
     1511        printk("\n[PANIC] in %s : cannot get valid PID in cluster %x / PID = %x\n",
     1512        __FUNCTION__ , local_cxy, pid );
     1513        hal_core_sleep();
     1514    }
     1515
    14971516    // initialize PID, REF_XP, PARENT_XP, and STATE
    1498     process->pid        = 0;
     1517    // the kernel process_zero is its own parent_process,
     1518    // reference_process, and owner_process, and cannot be killed...
     1519    process->pid        = pid;
    14991520    process->ref_xp     = XPTR( local_cxy , process );
    15001521    process->owner_xp   = XPTR( local_cxy , process );
    1501     process->parent_xp  = XPTR_NULL;
     1522    process->parent_xp  = XPTR( local_cxy , process );
    15021523    process->term_state = 0;
    15031524
     
    15181539                           LOCK_PROCESS_CHILDREN );
    15191540
     1541    // register kernel process in cluster manager local_list
     1542    cluster_process_local_link( process );
     1543   
    15201544        hal_fence();
    15211545
     
    16861710    pid_t         pid;
    16871711    pid_t         ppid;
     1712    lpid_t        lpid;
    16881713    uint32_t      state;
    16891714    uint32_t      th_nr;
     
    17071732    process_cxy = GET_CXY( process_xp );
    17081733
    1709     // get PID and state
     1734    // get process PID, LPID, and state
    17101735    pid   = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid ) );
     1736    lpid  = LPID_FROM_PID( pid );
    17111737    state = hal_remote_l32( XPTR( process_cxy , &process_ptr->term_state ) );
    17121738
    1713     // get PPID
     1739    // get process PPID
    17141740    parent_xp  = hal_remote_l64( XPTR( process_cxy , &process_ptr->parent_xp ) );
    17151741    parent_cxy = GET_CXY( parent_xp );
     
    17251751    owner_ptr = GET_PTR( owner_xp );
    17261752
    1727     // get extended pointer on TXT_RX file descriptor attached to process
    1728     txt_file_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) );
    1729 
    1730     assert( (txt_file_xp != XPTR_NULL) ,
    1731     "process must be attached to one TXT terminal\n" );
    1732 
    1733     // get TXT_RX chdev pointers
    1734     txt_chdev_xp  = chdev_from_file( txt_file_xp );
    1735     txt_chdev_cxy = GET_CXY( txt_chdev_xp );
    1736     txt_chdev_ptr = GET_PTR( txt_chdev_xp );
    1737 
    1738     // get TXT_RX name and ownership
    1739     hal_remote_strcpy( XPTR( local_cxy , txt_name ) ,
    1740                        XPTR( txt_chdev_cxy , txt_chdev_ptr->name ) );
     1753    // get process TXT name and .elf name
     1754    if( lpid )                                   // user process
     1755    {
     1756
     1757        // get extended pointer on file descriptor associated to TXT_RX
     1758        txt_file_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) );
     1759
     1760        assert( (txt_file_xp != XPTR_NULL) ,
     1761        "process must be attached to one TXT terminal\n" );
     1762
     1763        // get TXT_RX chdev pointers
     1764        txt_chdev_xp  = chdev_from_file( txt_file_xp );
     1765        txt_chdev_cxy = GET_CXY( txt_chdev_xp );
     1766        txt_chdev_ptr = GET_PTR( txt_chdev_xp );
     1767
     1768        // get TXT_RX name and ownership
     1769        hal_remote_strcpy( XPTR( local_cxy , txt_name ) ,
     1770                           XPTR( txt_chdev_cxy , txt_chdev_ptr->name ) );
    17411771   
    1742     txt_owner_xp = (xptr_t)hal_remote_l64( XPTR( txt_chdev_cxy,
    1743                                                  &txt_chdev_ptr->ext.txt.owner_xp ) );
    1744    
    1745     // get process .elf name
    1746     elf_file_xp   = hal_remote_l64( XPTR( process_cxy , &process_ptr->vfs_bin_xp ) );
    1747     elf_file_cxy  = GET_CXY( elf_file_xp );
    1748     elf_file_ptr  = (vfs_file_t *)GET_PTR( elf_file_xp );
    1749     elf_inode_ptr = (vfs_inode_t *)hal_remote_lpt( XPTR( elf_file_cxy , &elf_file_ptr->inode ) );
    1750     vfs_inode_get_name( XPTR( elf_file_cxy , elf_inode_ptr ) , elf_name );
     1772        txt_owner_xp = (xptr_t)hal_remote_l64( XPTR( txt_chdev_cxy,
     1773                                                     &txt_chdev_ptr->ext.txt.owner_xp ) );
     1774
     1775        // get process .elf name
     1776        elf_file_xp   = hal_remote_l64( XPTR( process_cxy , &process_ptr->vfs_bin_xp ) );
     1777        elf_file_cxy  = GET_CXY( elf_file_xp );
     1778        elf_file_ptr  = GET_PTR( elf_file_xp );
     1779        elf_inode_ptr = hal_remote_lpt( XPTR( elf_file_cxy , &elf_file_ptr->inode ) );
     1780        vfs_inode_get_name( XPTR( elf_file_cxy , elf_inode_ptr ) , elf_name );
     1781    }
     1782    else                                         // kernel process_zero
     1783    {
     1784        // TXT name and .elf name are not registered in kernel process_zero
     1785        strcpy( txt_name , "txt0_rx" );
     1786        txt_owner_xp = process_xp;
     1787        strcpy( elf_name , "kernel.elf" );
     1788    }
    17511789
    17521790    // display process info
  • trunk/kernel/kern/thread.c

    r564 r580  
    12161216    xptr_t        lock_xp;             // extended pointer on lock protecting  this list
    12171217
     1218#if DEBUG_THREAD_GET_XPTR
     1219uint32_t cycle  = (uint32_t)hal_get_cycles();
     1220thread_t * this = CURRENT_THREAD;
     1221if( DEBUG_THREAD_GET_XPTR < cycle )
     1222printk("\n[DBG] %s : thread %x in process %x enters / pid %x / trdid %x / cycle %d\n",
     1223__FUNCTION__, this->trdid, this->process->pid, pid, trdid, cycle );
     1224#endif
     1225
    12181226    // get target cluster identifier and local thread identifier
    12191227    target_cxy         = CXY_FROM_TRDID( trdid );
     
    12351243    remote_queuelock_acquire( lock_xp );
    12361244
     1245#if( DEBUG_THREAD_GET_XPTR & 1 )
     1246if( DEBUG_THREAD_GET_XPTR < cycle )
     1247printk("\n[DBG]  %s : scan processes in cluster %x :\n", __FUNCTION__, target_cxy );
     1248#endif
     1249
    12371250    // scan the list of local processes in target cluster
    12381251    xptr_t  iter;
     
    12431256        target_process_ptr = GET_PTR( target_process_xp );
    12441257        target_process_pid = hal_remote_l32( XPTR( target_cxy , &target_process_ptr->pid ) );
     1258
     1259#if( DEBUG_THREAD_GET_XPTR & 1 )
     1260if( DEBUG_THREAD_GET_XPTR < cycle )
     1261printk(" - process %x\n", target_process_pid );
     1262#endif
     1263
    12451264        if( target_process_pid == pid )
    12461265        {
     
    12541273
    12551274    // check PID found
    1256     if( found == false ) return XPTR_NULL;
     1275    if( found == false )
     1276    {
     1277
     1278#if( DEBUG_THREAD_GET_XPTR & 1 )
     1279if( DEBUG_THREAD_GET_XPTR < cycle )
     1280printk("\n[DBG] %s : pid %x not found in cluster %x\n",
     1281__FUNCTION__, pid, target_cxy );
     1282#endif
     1283        return XPTR_NULL;
     1284    }
    12571285
    12581286    // get target thread local pointer
     
    12601288    target_thread_ptr = (thread_t *)hal_remote_lpt( xp );
    12611289
    1262     if( target_thread_ptr == NULL )  return XPTR_NULL;
     1290    if( target_thread_ptr == NULL )
     1291    {
     1292
     1293#if( DEBUG_THREAD_GET_XPTR & 1 )
     1294if( DEBUG_THREAD_GET_XPTR < cycle )
     1295printk("\n[DBG] %s : thread %x not registered in process %x in cluster %x\n",
     1296__FUNCTION__, trdid, pid, target_cxy );
     1297#endif
     1298        return XPTR_NULL;
     1299    }
     1300
     1301#if DEBUG_THREAD_GET_XPTR
     1302cycle  = (uint32_t)hal_get_cycles();
     1303if( DEBUG_THREAD_GET_XPTR < cycle )
     1304printk("\n[DBG] %s : thread %x in process %x exit / pid %x / trdid %x / cycle %d\n",
     1305__FUNCTION__, this->trdid, this->process->pid, pid, trdid, cycle );
     1306#endif
    12631307
    12641308    return XPTR( target_cxy , target_thread_ptr );
     
    12871331        // display error message on TXT0
    12881332        nolock_printk("\n[PANIC] in %s / thread %x in process %x [%x] cannot yield : "
    1289         "%d busylock(s) / cycle %d\n",
     1333        "hold %d busylock(s) / cycle %d\n",
    12901334        func_str, thread->trdid, thread->process->pid, thread,
    12911335        thread->busylocks, (uint32_t)hal_get_cycles() );
    12921336
    12931337#if DEBUG_BUSYLOCK
    1294 if( XPTR( local_cxy , thread ) == DEBUG_BUSYLOCK_THREAD_XP )
    1295 {
    1296     // get root of list of taken busylocks
    1297     xptr_t    root_xp  = XPTR( local_cxy , &thread->busylocks_root );
    1298     xptr_t    iter_xp;
    1299 
    1300     // scan list of busylocks
    1301     XLIST_FOREACH( root_xp , iter_xp )
    1302     {
    1303         xptr_t       lock_xp   = XLIST_ELEMENT( iter_xp , busylock_t , xlist );
    1304         cxy_t        lock_cxy  = GET_CXY( lock_xp );
    1305         busylock_t * lock_ptr  = GET_PTR( lock_xp );
    1306         uint32_t     lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) );
    1307         nolock_printk(" - %s in cluster %x\n", lock_type_str[lock_type] , lock_cxy );
    1308     }
     1338
     1339// get root of list of taken busylocks
     1340xptr_t    root_xp  = XPTR( local_cxy , &thread->busylocks_root );
     1341xptr_t    iter_xp;
     1342
     1343// scan list of busylocks
     1344XLIST_FOREACH( root_xp , iter_xp )
     1345{
     1346    xptr_t       lock_xp   = XLIST_ELEMENT( iter_xp , busylock_t , xlist );
     1347    cxy_t        lock_cxy  = GET_CXY( lock_xp );
     1348    busylock_t * lock_ptr  = GET_PTR( lock_xp );
     1349    uint32_t     lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) );
     1350    nolock_printk(" - %s in cluster %x\n", lock_type_str[lock_type] , lock_cxy );
    13091351}
     1352
    13101353#endif
    13111354
     
    13181361}  // end thread_assert_can yield()
    13191362
    1320 #if DEBUG_BUSYLOCK
    1321 
    1322 ////////////////////////////////////////////////////
    1323 void thread_display_busylocks( uint32_t   lock_type,
    1324                                bool_t     is_acquire )
    1325 {
    1326     xptr_t    iter_xp;
    1327 
    1328     // get cluster and local pointer of target thread
    1329     cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
    1330     thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
    1331 
    1332     // get extended pointer on root of busylocks
    1333     xptr_t    root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root );
    1334 
    1335    // get pointers on TXT0 chdev
    1336     xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
    1337     cxy_t     txt0_cxy = GET_CXY( txt0_xp );
    1338     chdev_t * txt0_ptr = GET_PTR( txt0_xp );
    1339 
    1340     // get extended pointer on remote TXT0 lock
    1341     xptr_t  txt0_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
    1342 
    1343     // get TXT0 lock
    1344     remote_busylock_acquire( txt0_lock_xp );
    1345 
    1346     if( is_acquire )
    1347     {
    1348         nolock_printk("\n### thread [%x,%x] ACQUIRE lock %s / root %x / locks :\n",
    1349         thread_cxy, thread_ptr, lock_type_str[lock_type], GET_PTR(root_xp) );
     1363//////////////////////////////////////////////////
     1364void thread_display_busylocks( xptr_t  thread_xp )
     1365{
     1366    if( DEBUG_BUSYLOCK )
     1367    {
     1368        xptr_t    iter_xp;
     1369
     1370        // get cluster and local pointer of target thread
     1371        cxy_t      thread_cxy = GET_CXY( thread_xp );
     1372        thread_t * thread_ptr = GET_PTR( thread_xp );
     1373
     1374        // get target thread TRDID and busylocks
     1375        trdid_t  trdid = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->trdid ));
     1376        uint32_t locks = hal_remote_l32(XPTR( thread_cxy , &thread_ptr->busylocks ));
     1377
     1378        // get target thread process and PID;
     1379        process_t * process = hal_remote_lpt(XPTR( thread_cxy , &thread_ptr->process ));
     1380        pid_t       pid     = hal_remote_l32(XPTR( thread_cxy , &process->pid ));
     1381
     1382        // get extended pointer on root of busylocks
     1383        xptr_t    root_xp = XPTR( thread_cxy , &thread_ptr->busylocks_root );
     1384
     1385        // get pointers on TXT0 chdev
     1386        xptr_t    txt0_xp  = chdev_dir.txt_tx[0];
     1387        cxy_t     txt0_cxy = GET_CXY( txt0_xp );
     1388        chdev_t * txt0_ptr = GET_PTR( txt0_xp );
     1389
     1390        // get extended pointer on remote TXT0 lock
     1391        xptr_t  txt0_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
     1392
     1393        // get TXT0 lock
     1394        remote_busylock_acquire( txt0_lock_xp );
     1395
     1396        // display header
     1397        nolock_printk("\n***** thread %x in process %x : %d busylocks at cycle %d\n",
     1398        trdid, pid, locks, (uint32_t)hal_get_cycles() );
     1399
     1400        // scan the xlist of busylocks when required
     1401        if( locks )
     1402        {
     1403            XLIST_FOREACH( root_xp , iter_xp )
     1404            {
     1405                xptr_t       lock_xp   = XLIST_ELEMENT( iter_xp , busylock_t , xlist );
     1406                cxy_t        lock_cxy  = GET_CXY( lock_xp );
     1407                busylock_t * lock_ptr  = GET_PTR( lock_xp );
     1408                uint32_t     lock_type = hal_remote_l32(XPTR( lock_cxy , &lock_ptr->type ));
     1409                nolock_printk(" - %s in cluster %x\n", lock_type_str[lock_type] , lock_cxy );
     1410            }
     1411        }
     1412
     1413        // release TXT0 lock
     1414        remote_busylock_release( txt0_lock_xp );
    13501415    }
    13511416    else
    13521417    {
    1353         nolock_printk("\n### thread [%x,%x] RELEASE lock %s / root %x / locks :\n",
    1354         thread_cxy, thread_ptr, lock_type_str[lock_type], GET_PTR(root_xp) );
    1355     }
    1356 
    1357     int i;
    1358 
    1359     XLIST_FOREACH( root_xp , iter_xp )
    1360     {
    1361         xptr_t       ilock_xp   = XLIST_ELEMENT( iter_xp , busylock_t , xlist );
    1362         cxy_t        ilock_cxy  = GET_CXY( ilock_xp );
    1363         busylock_t * ilock_ptr  = GET_PTR( ilock_xp );
    1364         uint32_t     ilock_type = hal_remote_l32( XPTR( ilock_cxy , &ilock_ptr->type ) );
    1365         nolock_printk(" - %s in cluster %x\n", lock_type_str[ilock_type] , ilock_cxy );
    1366     }
    1367 
    1368     // release TXT0 lock
    1369     remote_busylock_release( txt0_lock_xp );
    1370 }
    1371 #endif
     1418        // display a warning
     1419        printk("\n[WARNING] set the DEBUG_BUSYLOCK parmeter in kernel_config.h"
     1420        " to use the %s function\n", __FUNCTION__ );
     1421    }
     1422}  // end thread_display_busylock()
  • trunk/kernel/kern/thread.h

    r564 r580  
    467467
    468468/***************************************************************************************
    469  * This debug function display the list of busylocks currently owned by a thread
    470  * identified by the DEBUG_BUSYLOCK_THREAD_XP parameter.
    471  * It is called each time the target thread acquire or release a busylock
    472  * (local or remote). It is never called when DEBUG_BUSYLOCK_THEAD_CP == 0.
    473  ***************************************************************************************
    474  * @ lock_type  : type of acquired / released busylock.
    475  * @ is_acquire : change is an acquire when true / change is a release when false.
    476  **************************************************************************************/
    477 void thread_display_busylocks( uint32_t lock_type,
    478                                bool_t   is_acquire );
     469 * This debug function display the list of busylocks (local or remote) currently owned
     470 * by a thread identified by the <thread_xp> argument.
     471 * WARNING : it can be called by the idbg tool, but the DEBUG_BUSYLOCK parameter
     472 * must be set in the kernel_config.h file.
     473 ***************************************************************************************
     474 * @ thread_xp  : extended pointer on target thread.
     475 **************************************************************************************/
     476void thread_display_busylocks( xptr_t  thread_xp );
    479477
    480478
  • trunk/kernel/kernel_config.h

    r579 r580  
    175175#define DEBUG_THREAD_DELETE            0
    176176#define DEBUG_THREAD_DESTROY           0
     177#define DEBUG_THREAD_GET_XPTR          1
    177178#define DEBUG_THREAD_IDLE              0
    178179#define DEBUG_THREAD_INIT              0
     
    336337////////////////////////////////////////////////////////////////////////////////////////////
    337338
    338 #define CONFIG_THREADS_MAX_PER_CLUSTER      16      // max threads per cluster & process
     339#define CONFIG_THREADS_MAX_PER_CLUSTER      16      // max threads per cluster per process
    339340#define CONFIG_THREAD_DESC_SIZE             0x4000  // thread desc size (with kernel stack)
    340341#define CONFIG_THREAD_DESC_ORDER            2       // ln( number of 4K pages )
  • trunk/kernel/libk/busylock.c

    r563 r580  
    7777#if DEBUG_BUSYLOCK
    7878if( (lock->type != LOCK_CHDEV_TXT0) &&
    79     (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) &&
    8079    ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) )
    8180{
     
    8483    // update thread list of busylocks
    8584    xlist_add_last( root_xp , XPTR( local_cxy , &lock->xlist ) );
     85}
     86#endif
    8687
    87     // display list of taken locks for the selected thread
    88     thread_display_busylocks( lock->type , true );
     88#if( DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     89if( (lock->type != LOCK_CHDEV_TXT0) &&
     90    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     91{
     92    // get cluster and local pointer of target thread
     93    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     94    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     95
     96    // display message on kernel TXT0
     97    printk("\n### thread [%x,%x] ACQUIRE lock %s\n",
     98    thread_cxy, thread_ptr, lock_type_str[lock->type] );
    8999}
    90100#endif
     
    111121#if DEBUG_BUSYLOCK
    112122if( (lock->type != LOCK_CHDEV_TXT0) &&
    113     (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) &&
    114123    ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) )
    115124{
    116125    // remove lock from thread list of busylocks
    117126    xlist_unlink( XPTR( local_cxy , &lock->xlist ) );
     127}
     128#endif
    118129
    119     // display list of taken locks for the selected thread
    120     thread_display_busylocks( lock->type , false );
     130#if( DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     131if( (lock->type != LOCK_CHDEV_TXT0) &&
     132    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     133{
     134    // get cluster and local pointer of target thread
     135    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     136    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     137
     138    // display message on kernel TXT0
     139    printk("\n### thread [%x,%x] RELEASE lock %s\n",
     140    thread_cxy, thread_ptr, lock_type_str[lock->type] );
    121141}
    122142#endif
  • trunk/kernel/libk/remote_busylock.c

    r563 r580  
    8888uint32_t type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->type ) );
    8989if( (type != LOCK_CHDEV_TXT0) &&
    90     (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) &&
    9190    ((uint32_t)hal_get_cycles() > DEBUG_BUSYLOCK) )
    9291{
     
    9594    // update thread list of busyslocks
    9695    xlist_add_last( root_xp , XPTR( lock_cxy  , &lock_ptr->xlist ) );
     96}
     97#endif
    9798
    98     // display busylocks for the selected thread (acquire)
    99     thread_display_busylocks( type , true );
     99#if( DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     100if( (type != LOCK_CHDEV_TXT0) &&
     101    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     102{
     103    // get cluster and local pointer of target thread
     104    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     105    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     106
     107    // display message on kernel TXT0
     108    printk("\n### thread [%x,%x] ACQUIRE lock %s\n",
     109    thread_cxy, thread_ptr, lock_type_str[type] );
    100110}
    101111#endif
     
    132142    // remove lock from thread list of busyslocks
    133143    xlist_unlink( XPTR( lock_cxy  , &lock_ptr->xlist ) );
     144}
     145#endif
    134146
    135     // display busylocks for the selected thread (release)
    136     thread_display_busylocks( type , false );   
     147#if (DEBUG_BUSYLOCK && DEBUG_BUSYLOCK_THREAD_XP )
     148if( (type != LOCK_CHDEV_TXT0) &&
     149    (XPTR( local_cxy , this ) == DEBUG_BUSYLOCK_THREAD_XP) )
     150{
     151    // get cluster and local pointer of target thread
     152    cxy_t      thread_cxy = GET_CXY( DEBUG_BUSYLOCK_THREAD_XP );
     153    thread_t * thread_ptr = GET_PTR( DEBUG_BUSYLOCK_THREAD_XP );
     154
     155    // display message on kernel TXT0
     156    printk("\n### thread [%x,%x] RELEASE lock %s\n",
     157    thread_cxy, thread_ptr, lock_type_str[type] );
    137158}
    138159#endif
  • trunk/kernel/mm/vmm.c

    r577 r580  
    7878    vmm->vsegs_nr = 0;
    7979        xlist_root_init( XPTR( local_cxy , &vmm->vsegs_root ) );
    80         remote_rwlock_init( XPTR( local_cxy , &vmm->vsegs_lock ),LOCK_VMM_VSL );
     80        remote_rwlock_init( XPTR( local_cxy , &vmm->vsegs_lock ) , LOCK_VMM_VSL );
    8181
    8282assert( ((CONFIG_VMM_KENTRY_SIZE + CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE)
  • trunk/kernel/syscalls/shared_include/shared_almos.h

    r445 r580  
    5151    DISPLAY_TXT_PROCESSES     = 6,
    5252    DISPLAY_DQDT              = 7,
     53    DISPLAY_BUSYLOCKS         = 8,
    5354}
    5455display_type_t;
  • trunk/kernel/syscalls/sys_display.c

    r506 r580  
    4848    else if( type == DISPLAY_CHDEV             ) return "CHDEV";
    4949    else if( type == DISPLAY_TXT_PROCESSES     ) return "TXT_PROCESSES";
     50    else if( type == DISPLAY_DQDT              ) return "DQDT";
     51    else if( type == DISPLAY_BUSYLOCKS         ) return "BUSYLOCKS";
    5052}
    5153#endif
     
    8789
    8890#if DEBUG_SYSCALLS_ERROR
    89 printk("\n[ERROR] in %s : string buffer %x unmapped / thread %x / process %x\n",
    90 __FUNCTION__ , (intptr_t)arg0 , this->trdid , process->pid );
     91printk("\n[ERROR] in %s for STRING : string buffer %x unmapped\n",
     92__FUNCTION__ , (intptr_t)arg0 );
    9193#endif
    9294            this->errno = EINVAL;
     
    101103
    102104#if DEBUG_SYSCALLS_ERROR
    103 printk("\n[ERROR] in %s : string length %d too large / thread %x / process %x\n",
    104 __FUNCTION__ , length , this->trdid , process->pid );
     105printk("\n[ERROR] in %s for STRING : string length %d too large\n",
     106__FUNCTION__ , length );
    105107#endif
    106108            this->errno = EINVAL;
     
    125127
    126128#if DEBUG_SYSCALLS_ERROR
    127 printk("\n[ERROR] in %s : illegal cxy argument %x / thread %x / process %x\n",
    128 __FUNCTION__ , cxy , this->trdid , process->pid );
     129printk("\n[ERROR] in %s for VMM : process %x in cluster %x not found\n",
     130__FUNCTION__ , pid , cxy );
    129131#endif
    130132            this->errno = EINVAL;
     
    139141
    140142#if DEBUG_SYSCALLS_ERROR
    141 printk("\n[ERROR] in %s : process %x in cluster %x not found / thread %x / process %x\n",
    142 __FUNCTION__ , pid , cxy , this->trdid , process->pid );
     143printk("\n[ERROR] in %s for VMM : process %x in cluster %x not found\n",
     144__FUNCTION__ , pid , cxy );
    143145#endif
    144146            this->errno = EINVAL;
     
    170172
    171173#if DEBUG_SYSCALLS_ERROR
    172 printk("\n[ERROR] in %s : illegal cxy argument %x / thread %x / process %x\n",
    173 __FUNCTION__ , cxy , this->trdid , process->pid );
     174printk("\n[ERROR] in %s for SCHED : illegal cxy argument %x\n",
     175__FUNCTION__ , cxy );
    174176#endif
    175177            this->errno = EINVAL;
     
    182184
    183185#if DEBUG_SYSCALLS_ERROR
    184 printk("\n[ERROR] in %s : illegal lid argument %x / thread %x / process %x\n",
    185 __FUNCTION__ , lid , this->trdid , process->pid );
     186printk("\n[ERROR] in %s for SCHED : illegal lid argument %x\n",
     187__FUNCTION__ , lid );
    186188#endif
    187189            this->errno = EINVAL;
     
    208210
    209211#if DEBUG_SYSCALLS_ERROR
    210 printk("\n[ERROR] in %s : illegal cxy argument %x / thread %x / process %x\n",
    211 __FUNCTION__ , cxy , this->trdid , process->pid );
     212printk("\n[ERROR] in %s for CLUSTER_PROCESSES : illegal cxy argument %x\n",
     213__FUNCTION__ , cxy );
    212214#endif
    213215            this->errno = EINVAL;
     
    216218
    217219        cluster_processes_display( cxy );
     220    }
     221    //////////////////////////////
     222    else if( type == DISPLAY_VFS )
     223    {
     224        vfs_display( process->vfs_root_xp );
     225    }
     226    ////////////////////////////////
     227    else if( type == DISPLAY_CHDEV )
     228    {
     229        chdev_dir_display();
    218230    }
    219231    ////////////////////////////////////////
     
    227239
    228240#if DEBUG_SYSCALLS_ERROR
    229 printk("\n[ERROR] in %s : illegal txt_id argument %d / thread %x / process %x\n",
    230 __FUNCTION__ , txt_id , this->trdid , process->pid );
     241printk("\n[ERROR] in %s for TXT_PROCESSES : illegal txt_id argument %d\n",
     242__FUNCTION__ , txt_id );
    231243#endif
    232244            this->errno = EINVAL;
     
    236248        process_txt_display( txt_id );
    237249    }
    238     //////////////////////////////
    239     else if( type == DISPLAY_VFS )
    240     {
    241         vfs_display( process->vfs_root_xp );
    242     }
    243     ////////////////////////////////
    244     else if( type == DISPLAY_CHDEV )
    245     {
    246         chdev_dir_display();
    247     }
    248     ////////////////////////////////
     250    ///////////////////////////////
    249251    else if( type == DISPLAY_DQDT )
    250252    {
    251253        dqdt_display();
     254    }
     255    ////////////////////////////////////
     256    else if( type == DISPLAY_BUSYLOCKS )
     257    {
     258        pid_t   pid   = (cxy_t)arg0;
     259        trdid_t trdid = (trdid_t)arg1;
     260
     261        // get extended pointer on target thread
     262        xptr_t thread_xp = thread_get_xptr( pid , trdid );
     263
     264        if( thread_xp == XPTR_NULL )
     265        {
     266
     267#if DEBUG_SYSCALLS_ERROR
     268printk("\n[ERROR] in %s for BUSYLOCKS : thread %x in process %x not found\n",
     269__FUNCTION__ , trdid , pid );
     270#endif
     271            this->errno = EINVAL;
     272            return -1;
     273        }
     274
     275        thread_display_busylocks( thread_xp );
    252276    }
    253277    ////
     
    256280
    257281#if DEBUG_SYSCALLS_ERROR
    258 printk("\n[ERROR] in %s : undefined display type %x / thread %x / process %x\n",
    259         __FUNCTION__ , type , this->trdid , process->pid );
     282printk("\n[ERROR] in %s : undefined display type %d\n",
     283        __FUNCTION__ , type );
    260284#endif
    261285        this->errno = EINVAL;
  • trunk/libs/libalmosmkh/almosmkh.c

    r573 r580  
    8888}
    8989
    90 ////////////
    91 int getint( void )
     90///////////////////////////////
     91unsigned int get_uint32( void )
    9292{
    9393    unsigned int  i;
    94     int           val;    // ASCII character value
     94    int           c;    // ASCII character value
    9595
    9696    unsigned char buf[32];
     97
    9798    unsigned int  save          = 0;
    98     unsigned int  dec           = 0;
     99    unsigned int  value         = 0;
    99100    unsigned int  done          = 0;
    100101    unsigned int  overflow      = 0;
    101102    unsigned int  length        = 0;
    102  
     103
    103104    // get characters
    104105    while (done == 0)
    105106    {
    106107        // read one character
    107         val = getchar();
    108 
    109         // analyse character
    110         if ((val > 0x2F) && (val < 0x3A))         // decimal character
    111         {
    112             buf[length] = (unsigned char)val;
     108        c = getchar();
     109
     110        // analyse this character
     111        if ( ((c > 0x2F) && (c < 0x3A)) ||                      // 0 to 9
     112             ((c > 0x40) && (c < 0x47)) ||                      // A to F
     113             ((c > 0x60) && (c < 0x67)) ||                      // a to f
     114             (((c == 0x58) || (c == 0x78)) && (length == 1)) )  // X or x
     115        {
     116            putchar( c );                       // echo
     117            if ( c > 0x60 )  c = c - 0x20;      // to upper case
     118            buf[length] = (unsigned char)c;
    113119            length++;                     
    114             putchar( val );                       // echo
    115         }
    116         else if (val == 0x0A)                     // LF character
     120        }
     121        else if (c == 0x0A)                                     // LF character
    117122        {
    118123            done = 1;
    119124        }
    120         else if ( (val == 0x7F) ||                // DEL character
    121                   (val == 0x08) )                 // BS  character
     125        else if ( (c == 0x7F) ||                                // DEL character
     126                  (c == 0x08) )                                 // BS  character
    122127        {
    123128            if ( length > 0 )
    124129            {
    125130                length--;         
    126                 printf("\b \b");                  // BS /  / BS
     131                printf("\b \b");                // BS /  / BS
    127132            }
    128133        }
    129         else if ( val == 0 )                      // EOF
     134        else if ( c == 0 )                                      // EOF character
    130135        {
    131136            return -1;
     
    140145    }  // end while characters
    141146
    142     // string to int conversion with overflow detection 
     147    // string to int conversion with overflow detection
    143148    if ( overflow == 0 )
    144149    {
    145         for (i = 0; (i < length) && (overflow == 0) ; i++)
    146         {
    147             dec = dec * 10 + (buf[i] - 0x30);
    148             if (dec < save)  overflow = 1;
    149             save = dec;
     150        // test (decimal / hexa)
     151        if( (buf[0] == 0x30) && (buf[1] == 0x58) )     // hexadecimal input
     152        {
     153            for (i = 2; (i < length) && (overflow == 0) ; i++)
     154            {
     155                if( buf[i] < 0x40 ) value = (value << 4) + (buf[i] - 0x30);
     156                else                value = (value << 4) + (buf[i] - 0x37);
     157                if (value < save) overflow = 1;
     158                save = value;
     159            }
     160        }
     161        else                                           // decimal input
     162        {
     163            for (i = 0; (i < length) && (overflow == 0) ; i++)
     164            {
     165                value = (value * 10) + (buf[i] - 0x30);
     166                if (value < save) overflow = 1;
     167                save = value;
     168            }
    150169        }
    151170    }
     
    155174    {
    156175        // return value
    157         return dec;
     176        return value;
    158177    }
    159178    else
     
    171190        return 0;
    172191    }
    173 }  // end getint()
     192}  // end get_uint32()
    174193
    175194
     
    184203}
    185204
    186 ///////////////////////////////////
     205/////////////////////////////////////////////////////
    187206int display_vmm( unsigned int cxy, unsigned int pid )
    188207{
    189208    return hal_user_syscall( SYS_DISPLAY,
    190209                             DISPLAY_VMM,
    191                              (reg_t)pid,
    192                              (reg_t)cxy, 0 );
     210                             (reg_t)cxy,
     211                             (reg_t)pid, 0 );
    193212}
    194213
     
    211230}
    212231
    213 ///////////////////
     232////////////////////////////////////////
     233int display_busylocks( unsigned int pid,
     234                       unsigned int trdid )
     235{
     236    return hal_user_syscall( SYS_DISPLAY,
     237                             DISPLAY_BUSYLOCKS,
     238                             (reg_t)pid,
     239                             (reg_t)trdid, 0 );
     240}
     241
     242/////////////////////////
    214243int display_chdev( void )
    215244{
     
    258287   unsigned int  lid;
    259288   unsigned int  txt;
     289   unsigned int  pid;
     290   unsigned int  trdid;
    260291   unsigned int  active;
    261292
     
    270301                   "p : display on TXT0 process descriptors in cluster[cxy]\n"
    271302                   "s : display on TXT0 scheduler state for core[cxy,lid]\n"
    272                    "v : display on TXT0 VMM for calling process in cluster [cxy]\n"
     303                   "v : display on TXT0 VMM state for process[cxy,pid]\n"
    273304                   "t : display on TXT0 process decriptors attached to TXT[tid]\n"
     305                   "b : display on TXT0 busylocks taken by thread[pid,trdid]\n"
    274306                   "y : activate/desactivate trace for core[cxy,lid]\n"
    275307                   "x : force calling process to exit\n"
     
    280312        {
    281313            printf("p / cxy = ");
    282             cxy = getint();
     314            cxy = get_uint32();
    283315            display_cluster_processes( cxy );
    284316        }
     
    286318        {
    287319            printf("s / cxy = ");
    288             cxy = getint();
     320            cxy = get_uint32();
    289321            printf(" / lid = ");
    290             lid = getint();
     322            lid = get_uint32();
    291323            display_sched( cxy , lid );
    292324        }
     
    294326        {
    295327            printf("v / cxy = ");
    296             cxy = getint();
    297             display_vmm( cxy , (unsigned int)getpid() );
     328            cxy = get_uint32();
     329            printf(" / pid = ");
     330            pid = get_uint32();
     331            display_vmm( cxy , pid );
    298332        }
    299333        else if( cmd == 't' )
    300334        {
    301335            printf("t / txt_id = ");
    302             txt = getint();
     336            txt = get_uint32();
    303337            display_txt_processes( txt );
    304338        }
     
    306340        {
    307341            printf("y / active = ");
    308             active = getint();
     342            active = get_uint32();
    309343            printf(" / cxy = ");
    310             cxy    = getint();
     344            cxy    = get_uint32();
    311345            printf(" / lid = ");
    312             lid    = getint();
     346            lid    = get_uint32();
    313347            trace( active , cxy , lid );
     348        }
     349        else if( cmd == 'b' )
     350        {
     351            printf("b / pid = ");
     352            pid = get_uint32();
     353            printf(" / trdid = ");
     354            trdid = get_uint32();
     355            display_busylocks( pid , trdid );
    314356        }
    315357        else if( cmd == 'x' )
  • trunk/libs/libalmosmkh/almosmkh.h

    r478 r580  
    101101
    102102/***************************************************************************************
    103  * This function returns a positive integer fom the standard "stdin" stream.
     103 * This function returns an unsigned 32 bits integer from the standard "stdin" stream.
     104 * Both decimal numbers and hexadecimal numbers (prefixed by 0x) are supported.
    104105 ***************************************************************************************
    105106 * returns the integer value if success / returns -1 if failure.
    106107 **************************************************************************************/
    107 int getint( void );
     108unsigned int getint32( void );
    108109
    109110
  • trunk/libs/mini-libc/stdio.c

    r573 r580  
    286286}  // end printf()
    287287
    288 /////////////
     288///////////////////
    289289int getchar( void )
    290290{
  • trunk/params-hard.mk

    r579 r580  
    22
    33ARCH      = /users/alain/soc/tsar-trunk-svn-2013/platforms/tsar_generic_iob
    4 X_SIZE    = 2
    5 Y_SIZE    = 2
    6 NB_PROCS  = 2
     4X_SIZE    = 1
     5Y_SIZE    = 1
     6NB_PROCS  = 1
    77NB_TTYS   = 3
    88FBF_WIDTH = 128
  • trunk/user/idbg/idbg.c

    r475 r580  
    1616{
    1717    unsigned long long  cycle;
     18    unsigned int        cxy;
     19    unsigned int        lid;
    1820
    1921    get_cycle( &cycle );
     22    get_core( &cxy , &lid );
    2023
    21     printf( "\n[IDBG] starts at cycle %d\n", (unsigned int)cycle );
     24    printf( "\n[IDBG] starts on core[%x,%d] / cycle %d\n",
     25    cxy , lid , (unsigned int)cycle );
    2226
    2327    idbg();
  • trunk/user/pgcd/pgcd.c

    r574 r580  
    1818    int                opy;
    1919    unsigned long long cycle;
     20    unsigned int       cxy;
     21    unsigned int       lid;
    2022
    2123    get_cycle( &cycle );
    22     printf( "\n\n[PGCD] starts / cycle %d\n", (unsigned int)cycle );
     24    get_core( &cxy , &lid );
     25
     26    printf( "\n\n[PGCD] starts on core[%x,%d] / cycle %d\n",
     27    cxy , lid , (unsigned int)cycle );
    2328
    2429    while (1)
     
    2631        printf("\n*******************\n");
    2732        printf("operand X = ");
    28         opx = getint();
     33        opx = get_uint32();
    2934        printf("\n");
    3035        printf("operand Y = ");
    31         opy = getint();
     36        opy = get_uint32();
    3237        printf("\n");
    3338
Note: See TracChangeset for help on using the changeset viewer.