- Timestamp:
- May 9, 2018, 3:13:56 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/vfs.c
r438 r441 1441 1441 if( error ) 1442 1442 { 1443 printk("\n[ERROR] in %s : no memory for inode <%s> inpath <%s>\n",1444 __FUNCTION__ , name, pathname );1443 printk("\n[ERROR] in %s : thread %x cannot allocate inode for path <%s>\n", 1444 __FUNCTION__ , this , pathname ); 1445 1445 return ENOMEM; 1446 1446 } … … 1464 1464 if ( error ) 1465 1465 { 1466 printk("\n[ERROR] in %s : core[%x,%d]/ <%s> node not found in <%s>\n",1467 __FUNCTION__ , local_cxy , this->core->lid, name , pathname );1466 printk("\n[ERROR] in %s : thread %x / <%s> node not found in <%s>\n", 1467 __FUNCTION__ , this , name , pathname ); 1468 1468 return ENOENT; 1469 1469 } … … 1489 1489 if ( error ) 1490 1490 { 1491 printk("\n[ERROR] in %s : core[%x,%d]cannot access device for <%s>\n",1492 __FUNCTION__ , local_cxy , this->core->lid, name );1491 printk("\n[ERROR] in %s : thread %x / cannot access device for <%s>\n", 1492 __FUNCTION__ , this , name ); 1493 1493 return EIO; 1494 1494 } … … 1519 1519 // if( error ) 1520 1520 // { 1521 // printk("\n[ERROR] in %s : permission denied for %s\n", __FUNCTION__ , name ); 1521 // printk("\n[ERROR] in %s : thread %x / permission denied for %s\n", 1522 // __FUNCTION__ , this , name ); 1522 1523 // return EACCES; 1523 1524 // } -
trunk/kernel/kern/process.c
r440 r441 1165 1165 cycle = (uint32_t)hal_get_cycles(); 1166 1166 if( 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 );1167 printk("\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 ); 1169 1169 #endif 1170 1170 … … 1222 1222 { 1223 1223 char * path; // pathname to .elf file 1224 pid_t pid; // old_process PID /given to new_process1224 pid_t pid; // old_process PID, given to new_process 1225 1225 pid_t temp_pid; // temporary PID / given to old_process 1226 1226 process_t * old_process; // local pointer on old process … … 1231 1231 pthread_attr_t attr; // new thread attributes 1232 1232 lid_t lid; // selected core local index 1233 error_t error; 1234 1233 error_t error; // value returned by called functions 1234 1235 1235 // get old_thread / old_process / PID / parent_xp 1236 1236 old_thread = CURRENT_THREAD; … … 1240 1240 1241 1241 // get .elf pathname from exec_info 1242 path = exec_info->path;1242 path = exec_info->path; 1243 1243 1244 1244 // this function must be executed by a thread running in owner cluster … … 1261 1261 if( new_process == NULL ) 1262 1262 { 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 ); 1265 1264 return -1; 1266 1265 } … … 1297 1296 // register code & data vsegs as well as entry-point in new process VMM, 1298 1297 // 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 ) 1300 1301 { 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) ); 1303 1305 process_destroy( new_process ); 1306 old_process->pid = pid; 1304 1307 return -1; 1305 1308 } … … 1328 1331 if( error ) 1329 1332 { 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) ); 1332 1336 process_destroy( new_process ); 1337 old_process->pid = pid; 1333 1338 return -1; 1334 1339 } … … 1375 1380 cycle = (uint32_t)hal_get_cycles(); 1376 1381 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1377 printk("\n[DBG] %s : old _thread %x blocked / new_thread %x activated / cycle %d\n",1382 printk("\n[DBG] %s : old thread %x blocked for delete / new thread %x activated / cycle %d\n", 1378 1383 __FUNCTION__ , old_thread , new_thread , cycle ); 1379 1384 #endif … … 1735 1740 remote_spinlock_unlock( lock_xp ); 1736 1741 1737 #if( DEBUG_PROCESS_TXT_ATTACH & 1 ) 1742 #if DEBUG_PROCESS_TXT_ATTACH 1743 cycle = (uint32_t)hal_get_cycles(); 1744 uint32_t txt_id = hal_remote_lw( XPTR( chdev_cxy , &chdev_ptr->channel ) ); 1738 1745 if( 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 ); 1746 printk("\n[DBG] %s : thread %x exit / process %x detached from TXT %d / cycle %d\n", 1747 __FUNCTION__, CURRENT_THREAD, process_pid, txt_id, cycle ); 1758 1748 #endif 1759 1749 … … 1842 1832 uint32_t cycle = (uint32_t)hal_get_cycles(); 1843 1833 if( 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_p tr, process_pid, cycle );1834 printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n", 1835 __FUNCTION__, CURRENT_THREAD, process_pid, cycle ); 1846 1836 #endif 1847 1837 -
trunk/kernel/kern/process.h
r440 r441 510 510 * It is called only by the process_reference_init() function when creating a KSH process. 511 511 * 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. 513 514 ********************************************************************************************* 514 515 * @ return TXT terminal index if succes / kernel panic if no terminal found. -
trunk/kernel/kern/rpc.c
r440 r441 1666 1666 1667 1667 ///////////////////////////////////////////////////////////////////////////////////////// 1668 // [21] Marshaling functions attached to RPC_VMM_GET_ VSEG(blocking)1668 // [21] Marshaling functions attached to RPC_VMM_GET_PTE (blocking) 1669 1669 ///////////////////////////////////////////////////////////////////////////////////////// 1670 1670 … … 1689 1689 // initialise RPC descriptor header 1690 1690 rpc_desc_t rpc; 1691 rpc.index = RPC_VMM_GET_ VSEG;1691 rpc.index = RPC_VMM_GET_PTE; 1692 1692 rpc.blocking = true; 1693 1693 rpc.responses = 1; … … 1769 1769 // initialise RPC descriptor header 1770 1770 rpc_desc_t rpc; 1771 rpc.index = RPC_ THREAD_USER_CREATE;1771 rpc.index = RPC_KCM_ALLOC; 1772 1772 rpc.blocking = true; 1773 1773 rpc.responses = 1; … … 1819 1819 // initialise RPC descriptor header 1820 1820 rpc_desc_t rpc; 1821 rpc.index = RPC_ THREAD_USER_CREATE;1821 rpc.index = RPC_KCM_FREE; 1822 1822 rpc.blocking = true; 1823 1823 rpc.responses = 1; -
trunk/kernel/kernel_config.h
r440 r441 121 121 122 122 #define DEBUG_SYS_DISPLAY 0 123 #define DEBUG_SYS_EXEC 2124 #define DEBUG_SYS_EXIT 2123 #define DEBUG_SYS_EXEC 0 124 #define DEBUG_SYS_EXIT 0 125 125 #define DEBUG_SYS_FG 0 126 #define DEBUG_SYS_FORK 2126 #define DEBUG_SYS_FORK 0 127 127 #define DEBUG_SYS_GET_CONFIG 0 128 128 #define DEBUG_SYS_ISATTY 0 129 #define DEBUG_SYS_KILL 2129 #define DEBUG_SYS_KILL 0 130 130 #define DEBUG_SYS_MMAP 0 131 131 #define DEBUG_SYS_READ 0 132 132 #define DEBUG_SYS_THREAD_CANCEL 0 133 133 #define DEBUG_SYS_THREAD_CREATE 0 134 #define DEBUG_SYS_THREAD_EXIT 0134 #define DEBUG_SYS_THREAD_EXIT 1 135 135 #define DEBUG_SYS_THREAD_JOIN 0 136 136 #define DEBUG_SYS_THREAD_SLEEP 0 -
trunk/kernel/libk/elf.c
r438 r441 46 46 && (header->e_ident[EI_DATA] == ELFDATA2LSB) 47 47 && (header->e_ident[EI_VERSION] == EV_CURRENT) 48 /*49 && (header->e_ident[EI_OSABI] == ELFOSABI_NONE)50 */51 48 && ((header->e_machine == EM_MIPS) || 52 49 (header->e_machine == EM_MIPS_RS3_LE) || … … 63 60 if( header->e_ident[EI_VERSION] != EV_CURRENT ) 64 61 printk("\n[ERROR] in %s : Elf is not in Current Version\n", __FUNCTION__); 65 /* 66 if( header->e_ident[EI_OSABI] != ELFOSABI_NONE ) 67 printk("\n[ERROR] in %s : Unexpected Elf ABI, need UNIX System V ABI\n", __FUNCTION__ ); 68 */ 62 69 63 if( (header->e_machine != EM_MIPS) && 70 64 (header->e_machine != EM_MIPS_RS3_LE) && … … 248 242 if( error ) 249 243 { 250 printk("\n[ERROR] in %s : failed to open file %s\n", __FUNCTION__ , pathname );244 printk("\n[ERROR] in %s : failed to open file <%s>\n", __FUNCTION__ , pathname ); 251 245 return -1; 252 246 } … … 263 257 if( error ) 264 258 { 265 printk("\n[ERROR] in %s : cannot get header f ile %s\n", __FUNCTION__ , pathname );259 printk("\n[ERROR] in %s : cannot get header for <%s>\n", __FUNCTION__ , pathname ); 266 260 vfs_close( file_xp , file_id ); 267 261 return -1; … … 270 264 #if (DEBUG_ELF_LOAD & 1) 271 265 if( DEBUG_ELF_LOAD < cycle ) 272 printk("\n[DBG] %s : loaded elf header for %s\n", __FUNCTION__ , pathname );266 printk("\n[DBG] %s : loaded elf header for <%s>\n", __FUNCTION__ , pathname ); 273 267 #endif 274 268 … … 310 304 #if (DEBUG_ELF_LOAD & 1) 311 305 if( DEBUG_ELF_LOAD < cycle ) 312 printk("\n[DBG] %s : segments array allocated for %s\n", __FUNCTION__ , pathname );306 printk("\n[DBG] %s : segments array allocated for <%s>\n", __FUNCTION__ , pathname ); 313 307 #endif 314 308 … … 330 324 #if (DEBUG_ELF_LOAD & 1) 331 325 if( DEBUG_ELF_LOAD < cycle ) 332 printk("\n[DBG] %s loaded segments descriptors for %s\n", __FUNCTION__ , pathname );326 printk("\n[DBG] %s loaded segments descriptors for <%s>\n", __FUNCTION__ , pathname ); 333 327 #endif 334 328 -
trunk/kernel/mm/vmm.c
r440 r441 1395 1395 1396 1396 #if DEBUG_VMM_GET_ONE_PPN 1397 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1397 thread_t * this = CURRENT_THREAD; 1398 // if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1399 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1398 1400 printk("\n[DBG] %s : thread %x enter for vpn = %x / type = %s / index = %d\n", 1399 __FUNCTION__, CURRENT_THREAD, vpn, vseg_type_str(type), index );1401 __FUNCTION__, this, vpn, vseg_type_str(type), index ); 1400 1402 #endif 1401 1403 … … 1458 1460 1459 1461 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1460 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1462 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1463 // if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1461 1464 printk("\n[DBG] %s : thread %x for vpn = %x / elf_offset = %x\n", 1462 __FUNCTION__, CURRENT_THREAD, vpn, elf_offset );1465 __FUNCTION__, this, vpn, elf_offset ); 1463 1466 #endif 1464 1467 … … 1474 1477 1475 1478 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1476 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1479 // if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1480 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1477 1481 printk("\n[DBG] %s : thread%x for vpn = %x / fully in BSS\n", 1478 __FUNCTION__, CURRENT_THREAD, vpn );1482 __FUNCTION__, this, vpn ); 1479 1483 #endif 1480 1484 … … 1493 1497 1494 1498 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1495 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1499 // if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1500 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1496 1501 printk("\n[DBG] %s : thread %x, for vpn = %x / fully in mapper\n", 1497 __FUNCTION__, CURRENT_THREAD, vpn );1502 __FUNCTION__, this, vpn ); 1498 1503 #endif 1499 1504 if( mapper_cxy == local_cxy ) … … 1524 1529 1525 1530 #if (DEBUG_VMM_GET_ONE_PPN & 0x1) 1526 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1531 // if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1532 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1527 1533 printk("\n[DBG] %s : thread %x for vpn = %x / both mapper & BSS\n" 1528 1534 " %d bytes from mapper / %d bytes from BSS\n", 1529 __FUNCTION__, CURRENT_THREAD, vpn,1535 __FUNCTION__, this, vpn, 1530 1536 file_size - offset , offset + CONFIG_PPM_PAGE_SIZE - file_size ); 1531 1537 #endif … … 1571 1577 1572 1578 #if DEBUG_VMM_GET_ONE_PPN 1573 if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1579 // if( DEBUG_VMM_GET_ONE_PPN < (uint32_t)hal_get_cycles() ) 1580 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1574 1581 printk("\n[DBG] %s : thread %x exit for vpn = %x / ppn = %x\n", 1575 __FUNCTION__ , CURRENT_THREAD, vpn , *ppn );1582 __FUNCTION__ , this , vpn , *ppn ); 1576 1583 #endif 1577 1584 … … 1595 1602 error_t error; 1596 1603 1604 thread_t * this = CURRENT_THREAD; 1605 1597 1606 #if DEBUG_VMM_GET_PTE 1598 uint32_t cycle = (uint32_t)hal_get_cycles(); 1599 if( DEBUG_VMM_GET_PTE < cycle ) 1607 uint32_t cycle = (uint32_t)hal_get_cycles(); 1608 // if( DEBUG_VMM_GET_PTE < cycle ) 1609 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1600 1610 printk("\n[DBG] %s : thread %x enter / vpn %x / process %x / cow %d / cycle %d\n", 1601 __FUNCTION__ , CURRENT_THREAD, vpn , process->pid , cow , cycle );1611 __FUNCTION__ , this , vpn , process->pid , cow , cycle ); 1602 1612 #endif 1603 1613 … … 1613 1623 assert( (vseg != NULL) , __FUNCTION__, 1614 1624 "vseg undefined / vpn %x / thread %x / process %x / core[%x,%d] / cycle %d\n", 1615 vpn, CURRENT_THREAD, process->pid, local_cxy, CURRENT_THREAD->core->lid,1625 vpn, this, process->pid, local_cxy, this->core->lid, 1616 1626 (uint32_t)hal_get_cycles() ); 1617 1627 … … 1627 1637 assert( (old_attr & GPT_MAPPED), __FUNCTION__, 1628 1638 "PTE unmapped for a COW exception / vpn %x / thread %x / process %x / cycle %d\n", 1629 vpn, CURRENT_THREAD, process->pid, (uint32_t)hal_get_cycles() );1639 vpn, this, process->pid, (uint32_t)hal_get_cycles() ); 1630 1640 1631 1641 #if( DEBUG_VMM_GET_PTE & 1 ) 1632 if( DEBUG_VMM_GET_PTE < cycle ) 1642 // if( DEBUG_VMM_GET_PTE < cycle ) 1643 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1633 1644 printk("\n[DBG] %s : thread %x handling COW for vpn %x in process %x\n", 1634 __FUNCTION__, CURRENT_THREAD, vpn, process->pid );1645 __FUNCTION__, this, vpn, process->pid ); 1635 1646 #endif 1636 1647 … … 1691 1702 1692 1703 #if( DEBUG_VMM_GET_PTE & 1 ) 1693 if( DEBUG_VMM_GET_PTE < cycle ) 1704 // if( DEBUG_VMM_GET_PTE < cycle ) 1705 if( (vpn == 0x403) && ((local_cxy == 0) || (this->type == THREAD_RPC)) ) 1694 1706 printk("\n[DBG] %s : thread %x handling page fault for vpn %x in process %x\n", 1695 __FUNCTION__, CURRENT_THREAD, vpn, process->pid );1707 __FUNCTION__, this, vpn, process->pid ); 1696 1708 #endif 1697 1709 // allocate new_ppn, and initialize the new page … … 1733 1745 #if DEBUG_VMM_GET_PTE 1734 1746 cycle = (uint32_t)hal_get_cycles(); 1735 if( DEBUG_VMM_GET_PTE < cycle ) 1747 // if( DEBUG_VMM_GET_PTE < cycle ) 1748 if( (vpn == 0x403) && (local_cxy == 0) ) 1736 1749 printk("\n[DBG] %s : thread %x exit / vpn %x in process %x / ppn %x / attr %x / cycle %d\n", 1737 __FUNCTION__, CURRENT_THREAD, vpn, process->pid, new_ppn, new_attr, cycle );1750 __FUNCTION__, this, vpn, process->pid, new_ppn, new_attr, cycle ); 1738 1751 #endif 1739 1752 … … 1762 1775 #if DEBUG_VMM_HANDLE_PAGE_FAULT 1763 1776 uint32_t cycle = (uint32_t)hal_get_cycles(); 1764 if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1765 printk("\n[DBG] %s : thread %x enter for vpn %x / process %x / core[%x,%d] / cycle %d\n", 1766 __FUNCTION__, this, vpn, process->pid, local_cxy, this->core->lid, cycle ); 1777 // if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1778 if( (vpn == 0x403) && (local_cxy == 0) ) 1779 printk("\n[DBG] %s : thread %x in process %x enter for vpn %x / core[%x,%d] / cycle %d\n", 1780 __FUNCTION__, this, process->pid, vpn, local_cxy, this->core->lid, cycle ); 1767 1781 #endif 1768 1782 … … 1798 1812 if( local_cxy != ref_cxy ) 1799 1813 { 1814 1815 #if DEBUG_VMM_HANDLE_PAGE_FAULT 1816 // if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1817 if( (vpn == 0x403) && (local_cxy == 0) ) 1818 printk("\n[DBG] %s : thread %x in process %x call RPC_VMM_GET_PTE\n", 1819 __FUNCTION__, this, process->pid ); 1820 #endif 1821 1800 1822 rpc_vmm_get_pte_client( ref_cxy, 1801 1823 ref_ptr, … … 1826 1848 #if DEBUG_VMM_HANDLE_PAGE_FAULT 1827 1849 cycle = (uint32_t)hal_get_cycles(); 1828 if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1829 printk("\n[DBG] %s : thread %x exit for vpn %x / process %x / cycle %d\n", 1830 __FUNCTION__, this->trdid, vpn, process->pid, cycle ); 1850 // if( DEBUG_VMM_HANDLE_PAGE_FAULT < cycle ) 1851 if( (vpn == 0x403) && (local_cxy == 0) ) 1852 printk("\n[DBG] %s : thread %x in process %x exit for vpn %x / core[%x,%d] / cycle %d\n", 1853 __FUNCTION__, this, process->pid, vpn, local_cxy, this->core->lid, cycle ); 1831 1854 #endif 1832 1855 1833 1856 return error; 1834 1857 1835 } // end vmm_handle_page_fault() 1858 } // end vmm_handle_page_fault() 1859 1860 1861 1862 1863 1864 1865 1866 1836 1867 1837 1868 /* deprecated April 2018 [AG] -
trunk/kernel/syscalls/sys_exec.c
r438 r441 150 150 // Implementation note: 151 151 // This function must be called by the main thread (thread 0 in owner cluster). 152 // I Tbuild an exec_info_t structure containing all informations152 // It build an exec_info_t structure containing all informations 153 153 // required to initialize the new process descriptor and the associated thread. 154 154 // It includes the process main() arguments, the environment variables, … … 208 208 tm_start = hal_get_cycles(); 209 209 if( DEBUG_SYS_EXEC < tm_start ) 210 printk("\n[DBG] %s : thread %x enter / process %x / path %s/ cycle = %d\n",210 printk("\n[DBG] %s : thread %x in process %x enter for path <%s> / cycle = %d\n", 211 211 __FUNCTION__, this, pid, exec_info.path, (uint32_t)tm_start ); 212 212 #endif … … 219 219 220 220 #if DEBUG_SYSCALLS_ERROR 221 printk("\n[ERROR] in %s : cannot access args\n", __FUNCTION__ ); 221 printk("\n[ERROR] in %s : thread %x in process %x cannot access args\n", 222 __FUNCTION__ , this, pid ); 222 223 #endif 223 224 this->errno = EINVAL; … … 233 234 234 235 #if DEBUG_SYCALLS_ERROR 235 printk("\n[ERROR] in %s : cannot access envs\n", __FUNCTION__ ); 236 printk("\n[ERROR] in %s : thread %x in process %x cannot access envs\n", 237 __FUNCTION__ , this, pid ); 236 238 #endif 237 239 this->errno = EINVAL; … … 247 249 248 250 #if DEBUG_SYSCALLS_ERROR 249 printk("\n[ERROR] in %s : cannot create process %x in cluster %x\n",250 __FUNCTION__, pid, CXY_FROM_PID(pid));251 printk("\n[ERROR] in %s : thread %x in process %x cannot create process for <%s>\n", 252 __FUNCTION__, this, pid, exec_info.path ); 251 253 #endif 252 254 this->errno = error; … … 257 259 tm_end = hal_get_cycles(); 258 260 if( DEBUG_SYS_EXEC < tm_end ) 259 printk("\n[DBG] %s : thread %x exit / process %x/ cost = %d / cycle %d\n",261 printk("\n[DBG] %s : thread %x in process %x exit / cost = %d / cycle %d\n", 260 262 __FUNCTION__, this, pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 261 263 #endif 262 264 263 // deschedule <=> old thread suicide because the BLOCKED_GLOBAL 264 // and the FLAG_REQ_DELETE have been set by process_make_exec() 265 // In case of success, this calling thread deschedules, causing suicide, 266 // because a new process descriptor and its associated main thread 267 // have been created by the process_make_exec() function, and the 268 // BLOCKED_GLOBAL & FLAG_REQ_DELETE bits have been set for the calling thread. 265 269 sched_yield( "old process suicide in sys_exec()" ); 266 270 267 assert( false , __FUNCTION__ , "This code should not be executed\n" );268 269 271 return 0; 270 272 -
trunk/kernel/syscalls/sys_exit.c
r440 r441 51 51 #endif 52 52 53 // get owner process descriptor pointers an cluster53 // get owner process descriptor pointers and cluster 54 54 xptr_t owner_xp = cluster_get_owner_process_from_pid( pid ); 55 55 cxy_t owner_cxy = GET_CXY( owner_xp ); … … 128 128 sched_yield( "process exit" ); 129 129 130 // this code should never be executed131 assert( false , __FUNCTION__ , "this code should not be executed...\n" );132 130 return 0; 133 131 -
trunk/kernel/syscalls/sys_read.c
r440 r441 223 223 if( DEBUG_SYS_READ < tm_end ) 224 224 printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n" 225 "nbytes = %d / fi rst byte = %c / file_id = %d / cost = %d\n",225 "nbytes = %d / file_id = %d / cost = %d\n", 226 226 __FUNCTION__ , this, process->pid, 227 (uint32_t)tm_start , nbytes , *((char *)(intptr_t)paddr) , file_id , 228 (uint32_t)(tm_end - tm_start) ); 227 (uint32_t)tm_start , nbytes , file_id , (uint32_t)(tm_end - tm_start) ); 229 228 #endif 230 229 … … 232 231 exit_sys_read = (uint32_t)tm_end; 233 232 234 printk("\n@@@@@@@@@@@@ timing to read character %c\n"233 printk("\n@@@@@@@@@@@@ timing to read character\n" 235 234 " - enter_sys_read = %d / delta %d\n" 236 235 " - enter_devfs_read = %d / delta %d\n" … … 247 246 " - exit_devfs_read = %d / delta %d\n" 248 247 " - exit_sys_read = %d / delta %d\n", 249 *((char *)(intptr_t)paddr) ,250 248 enter_sys_read , 0 , 251 249 enter_devfs_read , enter_devfs_read - enter_sys_read , -
trunk/kernel/syscalls/sys_write.c
r440 r441 184 184 if( DEBUG_SYS_WRITE < tm_end ) 185 185 printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n" 186 "nbytes = %d / fi rst byte = %c / file_id = %d / cost = %d\n",186 "nbytes = %d / file_id = %d / cost = %d\n", 187 187 __FUNCTION__, this, process->pid, (uint32_t)tm_start, 188 nbytes, *((char *)(intptr_t)paddr) ,file_id , (uint32_t)(tm_end - tm_start) );188 nbytes, file_id , (uint32_t)(tm_end - tm_start) ); 189 189 #endif 190 190 … … 192 192 exit_sys_write = (uint32_t)tm_end; 193 193 194 printk("\n@@@@@@@@@@@@ timing to write string %c\n"194 printk("\n@@@@@@@@@@@@ timing to write\n" 195 195 " - enter_sys_write = %d / delta %d\n" 196 196 " - enter_devfs_write = %d / delta %d\n" … … 207 207 " - exit_devfs_write = %d / delta %d\n" 208 208 " - exit_sys_write = %d / delta %d\n", 209 *((char *)(intptr_t)paddr) ,210 209 enter_sys_write , 0 , 211 210 enter_devfs_write , enter_devfs_write - enter_sys_write , -
trunk/libs/mini-libc/stdlib.c
r439 r441 166 166 va_list * args ) 167 167 { 168 unsigned int ps = 0; // write pointerto the string buffer168 unsigned int ps = 0; // write index to the string buffer 169 169 170 170 #define TO_STREAM(x) do { string[ps] = (x); ps++; if(ps==length) return -1; } while(0); -
trunk/user/init/init.c
r440 r441 18 18 #include <pthread.h> 19 19 20 #define DEBUG_INIT 120 #define DEBUG_INIT_PROCESS 1 21 21 22 22 // TODO make the cxy computation portable [AG] … … 76 76 } 77 77 78 #if DEBUG_INIT 78 #if DEBUG_INIT_PROCESS 79 79 80 80 unsigned int x_size; // number of clusters in a row … … 160 160 } // end KSH kill handling 161 161 162 #if ( DEBUG_INIT )162 #if DEBUG_INIT_PROCESS 163 163 164 164 // INIT displays processes and threads in all clusters -
trunk/user/ksh/ksh.c
r440 r441 395 395 int ret_exec; // return value from exec 396 396 unsigned int ksh_pid; // KSH process PID 397 unsigned int new_pid; // new process PID398 unsigned int rcv_pid; // terminating process PID399 397 char * pathname; // path to .elf file 400 398 unsigned int background; // background execution if non zero … … 425 423 else if (ret_fork == 0) // it is the CHILD process 426 424 { 427 // give back to KSH terminal ownership if required428 if( background ) fg( ksh_pid );429 430 425 // CHILD process exec NEW process 431 426 ret_exec = exec( pathname , NULL , NULL ); 432 427 428 // this is only executed in case of exec failure 433 429 if( ret_exec ) 434 430 { 435 printf(" error: newprocess unable to exec <%s>\n", pathname );436 return;431 printf(" error: child process unable to exec <%s>\n", pathname ); 432 exit( 0 ); 437 433 } 438 434 } 439 435 else // it is the parent KSH : ret_fork is the new process PID 440 436 { 441 new_pid = ret_fork; 442 443 // wait new process completion 444 rcv_pid = wait( &status ); 445 446 if( rcv_pid == new_pid ) 447 { 448 printf("\n\n %s normal termination / status = %x\n\n", 449 pathname , (status &0xFF) ); 450 return; 451 } 452 else 453 { 454 printf("\n\n %s abnormal termination / status = %x\n\n", 455 pathname , (status &0xFF) ); 456 return; 457 } 437 // give back terminal ownership to KSH if new process created in background / 438 // wait new process completion before returning to command interpreter otherwise 439 if( background ) fg( ksh_pid ); 440 else wait( &status ); 441 442 // return to command interpreter 443 return; 458 444 } 459 445 } // end cmd_load … … 758 744 printf("# "); 759 745 } 746 else 747 { 748 printf("\n# "); 749 } 760 750 } 761 751 else if (c == '\t') // tabulation => do nothing -
trunk/user/sort/sort.c
r440 r441 156 156 unsigned int main_uid = ptr->main_uid; 157 157 158 printf("\n### core[%x,%d] enter sort : threads %d / thread_uid %x / main_uid %x / cycle %d\n",159 cxy, lid, threads, thread_uid, main_uid, (int)cycle );160 161 while( 1 ) { asm volatile("nop"); }162 163 158 unsigned int items = ARRAY_LENGTH / threads; 164 159 unsigned int stages = __builtin_ctz( threads ) + 1; … … 316 311 if( thread_uid != main_uid ) 317 312 { 318 319 get_cycle( &cycle );320 printf("\n### main creates thread_uid %d / &sort_arg %x / cycle %d\n",321 thread_uid, &arg[thread_uid], (unsigned int)cycle );322 323 313 if ( pthread_create( &trdid, // not used because no join 324 314 &attr[thread_uid], // thread attributes … … 344 334 sort( &arg[main_uid] ); 345 335 336 while( 1 ) asm volatile( "nop" ); 337 346 338 // Check result 347 339 int success = 1; … … 352 344 (threads==512) ) ? array1 : array0; 353 345 354 for( n=0 ; n<(ARRAY_LENGTH- 1) ; n++ )346 for( n=0 ; n<(ARRAY_LENGTH-2) ; n++ ) 355 347 { 356 348 if ( res_array[n] > res_array[n+1] )
Note: See TracChangeset
for help on using the changeset viewer.