Changeset 415 for trunk/kernel/mm
- Timestamp:
- Dec 22, 2017, 1:16:59 PM (7 years ago)
- Location:
- trunk/kernel/mm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r409 r415 53 53 54 54 55 //////////////////////////////////// 56 voidvmm_init( process_t * process )55 /////////////////////////////////////// 56 error_t vmm_init( process_t * process ) 57 57 { 58 58 error_t error; … … 97 97 local_cxy ); 98 98 99 assert( (vseg_kentry != NULL) , __FUNCTION__ , "cannot register kentry vseg\n" ); 99 if( vseg_kentry == NULL ) 100 { 101 printk("\n[ERROR] in %s : cannot register kentry vseg\n", __FUNCTION__ ); 102 return -1; 103 } 100 104 101 105 vmm->kent_vpn_base = base; … … 115 119 local_cxy ); 116 120 117 assert( (vseg_args != NULL) , __FUNCTION__ , "cannot create args vseg\n" ); 121 if( vseg_args == NULL ) 122 { 123 printk("\n[ERROR] in %s : cannot register args vseg\n", __FUNCTION__ ); 124 return -1; 125 } 118 126 119 127 vmm->args_vpn_base = base; … … 134 142 local_cxy ); 135 143 136 assert( (vseg_envs != NULL) , __FUNCTION__ , "cannot create envs vseg\n" ); 144 if( vseg_envs == NULL ) 145 { 146 printk("\n[ERROR] in %s : cannot register envs vseg\n", __FUNCTION__ ); 147 return -1; 148 } 137 149 138 150 vmm->envs_vpn_base = base; … … 141 153 error = hal_gpt_create( &vmm->gpt ); 142 154 143 assert( (error == 0) , __FUNCTION__ , "cannot create GPT\n"); 144 145 // architecture specific GPT initialization 155 if( error ) 156 printk("\n[ERROR] in %s : cannot create GPT\n", __FUNCTION__ ); 157 158 // initialize GPT (architecture specic) 146 159 // (For TSAR, identity map the kentry_vseg) 147 160 error = hal_vmm_init( vmm ); 148 161 149 assert( (error == 0) , __FUNCTION__ , "cannot initialize GPT\n"); 162 if( error ) 163 printk("\n[ERROR] in %s : cannot initialize GPT\n", __FUNCTION__ ); 150 164 151 165 // initialize STACK allocator … … 168 182 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , 169 183 process->pid , process->vmm.entry_point ); 184 185 return 0; 170 186 171 187 } // end vmm_init() … … 399 415 parent_lock_xp = XPTR( parent_cxy , &parent_vmm->vsegs_lock ); 400 416 401 // take the lock protecting the parent VSL402 remote_rwlock_rd_lock( parent_lock_xp );403 404 417 // initialize the lock protecting the child VSL 405 418 remote_rwlock_init( XPTR( local_cxy , &child_vmm->vsegs_lock ) ); … … 409 422 child_vmm->vsegs_nr = 0; 410 423 411 // create & initialize the child GPT as empty424 // create child GPT 412 425 error = hal_gpt_create( &child_vmm->gpt ); 426 413 427 if( error ) 414 428 { … … 419 433 // build extended pointer on parent VSL 420 434 parent_root_xp = XPTR( parent_cxy , &parent_vmm->vsegs_root ); 435 436 // take the lock protecting the parent VSL 437 remote_rwlock_rd_lock( parent_lock_xp ); 421 438 422 439 // loop on parent VSL xlist … … 501 518 // release the parent vsegs lock 502 519 remote_rwlock_rd_unlock( parent_lock_xp ); 520 521 // initialize child GPT (architecture specic) 522 // => For TSAR, identity map the kentry_vseg 523 error = hal_vmm_init( child_vmm ); 524 525 if( error ) 526 { 527 printk("\n[ERROR] in %s : cannot create GPT\n", __FUNCTION__ ); 528 return -1; 529 } 503 530 504 531 // initialize the child VMM STACK allocator -
trunk/kernel/mm/vmm.h
r409 r415 137 137 * - The "stack" vsegs are dynamically created by the thread_user_create() function. 138 138 * - The "file", "anon", "remote" vsegs are dynamically created by the mmap() syscall. 139 * TODO : Any error in this function gives a kernel panic => improve error handling.140 139 ********************************************************************************************* 141 140 * @ process : pointer on process descriptor 142 ********************************************************************************************/ 143 void vmm_init( struct process_s * process ); 141 * @ return 0 if success / return -1 if failure. 142 ********************************************************************************************/ 143 error_t vmm_init( struct process_s * process ); 144 144 145 145 /********************************************************************************************* … … 169 169 * @ child_process : local pointer on local child process descriptor. 170 170 * @ parent_process_xp : extended pointer on remote parent process descriptor. 171 * @ return 0 if success / return ENOMEMif failure.171 * @ return 0 if success / return -1 if failure. 172 172 ********************************************************************************************/ 173 173 error_t vmm_fork_copy( struct process_s * child_process,
Note: See TracChangeset
for help on using the changeset viewer.