Changeset 469 for trunk/kernel/kern/thread.c
- Timestamp:
- Aug 20, 2018, 1:04:16 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/thread.c
r457 r469 86 86 // return pointer on new thread descriptor 87 87 xptr_t base_xp = ppm_page2base( XPTR(local_cxy , page ) ); 88 return (thread_t *)GET_PTR( base_xp );88 return GET_PTR( base_xp ); 89 89 90 90 } // end thread_alloc() … … 419 419 uint32_t cycle = (uint32_t)hal_get_cycles(); 420 420 if( DEBUG_THREAD_USER_FORK < cycle ) 421 printk("\n[DBG] %s : thread %x enter / child_process %x / cycle %d\n",422 __FUNCTION__, CURRENT_THREAD , child_process->pid, cycle );421 printk("\n[DBG] %s : thread %x in process %x enter / child_process %x / cycle %d\n", 422 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, child_process->pid, cycle ); 423 423 #endif 424 424 … … 428 428 // get cluster and local pointer on parent thread descriptor 429 429 parent_cxy = GET_CXY( parent_thread_xp ); 430 parent_ptr = (thread_t *)GET_PTR( parent_thread_xp );430 parent_ptr = GET_PTR( parent_thread_xp ); 431 431 432 432 // get relevant fields from parent thread … … 538 538 if( mapped ) 539 539 { 540 // get pointers on the page descriptor 540 541 xptr_t page_xp = ppm_ppn2page( ppn ); 541 542 cxy_t page_cxy = GET_CXY( page_xp ); 542 page_t * page_ptr = (page_t *)GET_PTR( page_xp ); 543 page_t * page_ptr = GET_PTR( page_xp ); 544 545 // get extended pointers on forks and lock fields 546 xptr_t forks_xp = XPTR( page_cxy , &page_ptr->forks ); 547 xptr_t lock_xp = XPTR( page_cxy , &page_ptr->lock ); 548 549 // increment the forks counter 550 remote_spinlock_lock( lock_xp ); 543 551 hal_remote_atomic_add( XPTR( page_cxy , &page_ptr->forks ) , 1 ); 552 remote_spinlock_unlock( lock_xp ); 544 553 545 554 #if (DEBUG_THREAD_USER_FORK & 1) 546 555 cycle = (uint32_t)hal_get_cycles(); 547 556 if( DEBUG_THREAD_USER_FORK < cycle ) 548 printk("\n[DBG] %s : thread %x copied stack PTE to child GPT : vpn %x\n", 549 __FUNCTION__, CURRENT_THREAD, vpn ); 557 printk("\n[DBG] %s : thread %x in process %x copied one PTE to child GPT : vpn %x / forks %d\n", 558 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, vpn, 559 hal_remote_lw( XPTR( page_cxy , &page_ptr->forks) ) ); 550 560 #endif 551 561 … … 561 571 cycle = (uint32_t)hal_get_cycles(); 562 572 if( DEBUG_THREAD_USER_FORK < cycle ) 563 printk("\n[DBG] %s : thread %x exit / child_process %x/ child_thread %x / cycle %d\n",564 __FUNCTION__, CURRENT_THREAD , child_process->pid, child_ptr, cycle );573 printk("\n[DBG] %s : thread %x in process %x exit / child_thread %x / cycle %d\n", 574 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, child_ptr, cycle ); 565 575 #endif 566 576 … … 631 641 } 632 642 633 // update user stack in stackdescriptor643 // update user stack in thread descriptor 634 644 thread->u_stack_base = vseg->min; 635 645 thread->u_stack_size = vseg->max - vseg->min; … … 1172 1182 { 1173 1183 target_process_xp = XLIST_ELEMENT( iter , process_t , local_list ); 1174 target_process_ptr = (process_t *)GET_PTR( target_process_xp );1184 target_process_ptr = GET_PTR( target_process_xp ); 1175 1185 target_process_pid = hal_remote_lw( XPTR( target_cxy , &target_process_ptr->pid ) ); 1176 1186 if( target_process_pid == pid )
Note: See TracChangeset
for help on using the changeset viewer.