Changeset 635 for trunk/kernel/kern/process.c
- Timestamp:
- Jun 26, 2019, 11:42:37 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.c
r633 r635 72 72 process_t * process_alloc( void ) 73 73 { 74 kmem_req_t 75 76 req.type = KMEM_ PROCESS;77 req. size = sizeof(process_t);74 kmem_req_t req; 75 76 req.type = KMEM_KCM; 77 req.order = bits_log2( sizeof(process_t) ); 78 78 req.flags = AF_KERNEL; 79 79 80 return (process_t *)kmem_alloc( &req );80 return kmem_alloc( &req ); 81 81 } 82 82 … … 86 86 kmem_req_t req; 87 87 88 req.type = KMEM_ PROCESS;88 req.type = KMEM_KCM; 89 89 req.ptr = process; 90 90 kmem_free( &req ); … … 166 166 #endif 167 167 168 // initialize VSL lock s168 // initialize VSL lock 169 169 remote_rwlock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL ); 170 170 171 // register kernel vsegs in VMM as required by the architecture171 // register kernel vsegs in user process VMM as required by the architecture 172 172 error = hal_vmm_kernel_update( process ); 173 173 if( error ) … … 179 179 #if (DEBUG_PROCESS_REFERENCE_INIT & 1) 180 180 if( DEBUG_PROCESS_REFERENCE_INIT < cycle ) 181 printk("\n[%s] thread[%x,%x] registered kernel vsegs for process %x\n",181 printk("\n[%s] thread[%x,%x] registered kernel vsegs in VSL for process %x\n", 182 182 __FUNCTION__, parent_pid, this->trdid, pid ); 183 183 #endif … … 374 374 printk("\n[%s] thread[%x,%x] exit for process %x / cycle %d\n", 375 375 __FUNCTION__, parent_pid, this->trdid, pid, cycle ); 376 #endif 377 378 #if (DEBUG_PROCESS_REFERENCE_INIT & 1) 379 hal_vmm_display( parent_xp , false ); 380 hal_vmm_display( XPTR( local_cxy , process ) , false ); 376 381 #endif 377 382 … … 1088 1093 } 1089 1094 } 1095 1090 1096 //////////////////////////////////////////////////// 1091 1097 error_t process_fd_register( xptr_t process_xp, … … 1356 1362 1357 1363 #if DEBUG_PROCESS_MAKE_FORK 1358 uint32_t cycle = (uint32_t)hal_get_cycles();1364 uint32_t cycle; 1359 1365 thread_t * this = CURRENT_THREAD; 1360 1366 trdid_t trdid = this->trdid; 1361 1367 pid_t pid = this->process->pid; 1368 #endif 1369 1370 #if( DEBUG_PROCESS_MAKE_FORK & 1 ) 1371 cycle = (uint32_t)hal_get_cycles(); 1362 1372 if( DEBUG_PROCESS_MAKE_FORK < cycle ) 1363 1373 printk("\n[%s] thread[%x,%x] enter / cluster %x / cycle %d\n", … … 1367 1377 // allocate a process descriptor 1368 1378 process = process_alloc(); 1379 1369 1380 if( process == NULL ) 1370 1381 { … … 1427 1438 printk("\n[%s] thread[%x,%x] copied VMM from parent to child / cycle %d\n", 1428 1439 __FUNCTION__, pid, trdid, cycle ); 1440 hal_vmm_display( XPTR( local_cxy , process ) , true ); 1429 1441 #endif 1430 1442 … … 1438 1450 cycle = (uint32_t)hal_get_cycles(); 1439 1451 if( DEBUG_PROCESS_MAKE_FORK < cycle ) 1440 printk("\n[%s] thread[%x,%x] / child takes TXT ownership / cycle %d\n",1441 __FUNCTION__ , pid, trdid, cycle );1452 printk("\n[%s] thread[%x,%x] / child_process %x takes TXT ownership / cycle %d\n", 1453 __FUNCTION__ , pid, trdid, new_pid, cycle ); 1442 1454 #endif 1443 1455 … … 1471 1483 #endif 1472 1484 1473 // set COW flag in DATA, ANON, REMOTE vsegs forparent process VMM1485 // set COW flag in DATA, ANON, REMOTE vsegs in parent process VMM 1474 1486 // this includes all parent process copies in all clusters 1475 1487 if( parent_process_cxy == local_cxy ) // reference is local … … 1489 1501 cycle = (uint32_t)hal_get_cycles(); 1490 1502 if( DEBUG_PROCESS_MAKE_FORK < cycle ) 1491 printk("\n[%s] thread[%x,%x] set COW in parent and child / cycle %d\n",1503 printk("\n[%s] thread[%x,%x] set COW in DATA / ANON / REMOTE for parent and child / cycle %d\n", 1492 1504 __FUNCTION__, pid, trdid, cycle ); 1493 1505 #endif … … 1546 1558 #if DEBUG_PROCESS_MAKE_EXEC 1547 1559 uint32_t cycle = (uint32_t)hal_get_cycles(); 1548 if( local_cxy == 0x11)1560 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1549 1561 printk("\n[%s] thread[%x,%x] enters for %s / cycle %d\n", 1550 1562 __FUNCTION__, pid, thread->trdid, path, cycle ); … … 1569 1581 #if (DEBUG_PROCESS_MAKE_EXEC & 1) 1570 1582 cycle = (uint32_t)hal_get_cycles(); 1571 if( local_cxy == 0x11)1583 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1572 1584 printk("\n[%s] thread[%x,%x] opened file <%s> / cycle %d\n", 1573 1585 __FUNCTION__, pid, thread->trdid, path, cycle ); … … 1579 1591 #if (DEBUG_PROCESS_MAKE_EXEC & 1) 1580 1592 cycle = (uint32_t)hal_get_cycles(); 1581 if( local_cxy == 0x11)1593 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1582 1594 printk("\n[%s] thread[%x,%x] deleted existing threads / cycle %d\n", 1583 1595 __FUNCTION__, pid, thread->trdid, cycle ); … … 1589 1601 #if( DEBUG_PROCESS_MAKE_EXEC & 1 ) 1590 1602 cycle = (uint32_t)hal_get_cycles(); 1591 if( local_cxy == 0x11)1603 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1592 1604 printk("\n[%s] thread[%x,%x] completed VMM reset / cycle %d\n", 1593 1605 __FUNCTION__, pid, thread->trdid, cycle ); … … 1606 1618 #if( DEBUG_PROCESS_MAKE_EXEC & 1 ) 1607 1619 cycle = (uint32_t)hal_get_cycles(); 1608 if( local_cxy == 0x11)1620 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1609 1621 printk("\n[%s] thread[%x,%x] registered args/envs vsegs / cycle %d\n", 1610 1622 __FUNCTION__, pid, thread->trdid, cycle ); … … 1624 1636 #if( DEBUG_PROCESS_MAKE_EXEC & 1 ) 1625 1637 cycle = (uint32_t)hal_get_cycles(); 1626 if( local_cxy == 0x11)1638 if( DEBUG_PROCESS_MAKE_EXEC < cycle ) 1627 1639 printk("\n[%s] thread[%x,%x] registered code/data vsegs / cycle %d\n", 1628 1640 __FUNCTION__, pid, thread->trdid, cycle ); … … 1674 1686 hal_core_sleep(); 1675 1687 } 1688 1689 #if (DEBUG_PROCESS_ZERO_CREATE & 1) 1690 if( DEBUG_PROCESS_ZERO_CREATE < cycle ) 1691 printk("\n[%s] allocated pid %x in cluster %x\n", __FUNCTION__, pid, local_cxy ); 1692 #endif 1676 1693 1677 1694 // initialize PID, REF_XP, PARENT_XP, and STATE … … 1684 1701 process->term_state = 0; 1685 1702 1686 // initi lise VSL as empty1703 // initialize VSL as empty 1687 1704 vmm->vsegs_nr = 0; 1688 1705 xlist_root_init( XPTR( local_cxy , &vmm->vsegs_root ) ); 1689 1706 1690 // initialise GPT as empty 1707 #if (DEBUG_PROCESS_ZERO_CREATE & 1) 1708 if( DEBUG_PROCESS_ZERO_CREATE < cycle ) 1709 printk("\n[%s] initialized VSL empty in cluster %x\n", __FUNCTION__, local_cxy ); 1710 #endif 1711 1712 // initialize GPT as empty 1691 1713 error = hal_gpt_create( &vmm->gpt ); 1714 1692 1715 if( error ) 1693 1716 { … … 1695 1718 hal_core_sleep(); 1696 1719 } 1720 1721 #if (DEBUG_PROCESS_ZERO_CREATE & 1) 1722 if( DEBUG_PROCESS_ZERO_CREATE < cycle ) 1723 printk("\n[%s] initialized GPT empty in cluster %x\n", __FUNCTION__, local_cxy ); 1724 #endif 1697 1725 1698 1726 // initialize VSL and GPT locks … … 1701 1729 // create kernel vsegs in GPT and VSL, as required by the hardware architecture 1702 1730 error = hal_vmm_kernel_init( info ); 1731 1703 1732 if( error ) 1704 1733 { … … 1706 1735 hal_core_sleep(); 1707 1736 } 1737 1738 #if (DEBUG_PROCESS_ZERO_CREATE & 1) 1739 if( DEBUG_PROCESS_ZERO_CREATE < cycle ) 1740 printk("\n[%s] initialized hal specific VMM in cluster%x\n", __FUNCTION__, local_cxy ); 1741 #endif 1708 1742 1709 1743 // reset th_tbl[] array and associated fields … … 1716 1750 rwlock_init( &process->th_lock , LOCK_PROCESS_THTBL ); 1717 1751 1752 #if (DEBUG_PROCESS_ZERO_CREATE & 1) 1753 if( DEBUG_PROCESS_ZERO_CREATE < cycle ) 1754 printk("\n[%s] initialized th_tbl[] in cluster%x\n", __FUNCTION__, local_cxy ); 1755 #endif 1718 1756 1719 1757 // reset children list as empty … … 1722 1760 remote_queuelock_init( XPTR( local_cxy , &process->children_lock ), 1723 1761 LOCK_PROCESS_CHILDREN ); 1762 1763 #if (DEBUG_PROCESS_ZERO_CREATE & 1) 1764 if( DEBUG_PROCESS_ZERO_CREATE < cycle ) 1765 printk("\n[%s] initialized children list in cluster%x\n", __FUNCTION__, local_cxy ); 1766 #endif 1724 1767 1725 1768 // register kernel process in cluster manager local_list … … 1759 1802 // allocates memory for process descriptor from local cluster 1760 1803 process = process_alloc(); 1804 1805 1761 1806 if( process == NULL ) 1762 1807 { … … 1840 1885 1841 1886 #if (DEBUG_PROCESS_INIT_CREATE & 1) 1842 hal_vmm_display( process, true );1887 hal_vmm_display( XPTR( local_cxy , process ) , true ); 1843 1888 #endif 1844 1889
Note: See TracChangeset
for help on using the changeset viewer.