Changeset 415 for trunk/kernel/mm/vmm.c


Ignore:
Timestamp:
Dec 22, 2017, 1:16:59 PM (7 years ago)
Author:
alain
Message:

Few bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/vmm.c

    r409 r415  
    5353
    5454
    55 ////////////////////////////////////
    56 void vmm_init( process_t * process )
     55///////////////////////////////////////
     56error_t vmm_init( process_t * process )
    5757{
    5858    error_t   error;
     
    9797                                   local_cxy );
    9898
    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    }
    100104
    101105    vmm->kent_vpn_base = base;
     
    115119                                 local_cxy );
    116120
    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    }
    118126
    119127    vmm->args_vpn_base = base;
     
    134142                                 local_cxy );
    135143
    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    }
    137149
    138150    vmm->envs_vpn_base = base;
     
    141153    error = hal_gpt_create( &vmm->gpt );
    142154
    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)
    146159    // (For TSAR, identity map the kentry_vseg)
    147160    error = hal_vmm_init( vmm );
    148161
    149     assert( (error == 0) , __FUNCTION__ , "cannot initialize GPT\n");
     162    if( error )
     163    printk("\n[ERROR] in %s : cannot initialize GPT\n", __FUNCTION__ );
    150164
    151165    // initialize STACK allocator
     
    168182__FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid ,
    169183process->pid , process->vmm.entry_point );
     184
     185    return 0;
    170186
    171187}  // end vmm_init()
     
    399415    parent_lock_xp = XPTR( parent_cxy , &parent_vmm->vsegs_lock );
    400416
    401     // take the lock protecting the parent VSL
    402     remote_rwlock_rd_lock( parent_lock_xp );
    403 
    404417    // initialize the lock protecting the child VSL
    405418    remote_rwlock_init( XPTR( local_cxy , &child_vmm->vsegs_lock ) );
     
    409422    child_vmm->vsegs_nr = 0;
    410423
    411     // create & initialize the child GPT as empty
     424    // create child GPT
    412425    error = hal_gpt_create( &child_vmm->gpt );
     426
    413427    if( error )
    414428    {
     
    419433    // build extended pointer on parent VSL
    420434    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 );
    421438
    422439    // loop on parent VSL xlist
     
    501518    // release the parent vsegs lock
    502519    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    }
    503530
    504531    // initialize the child VMM STACK allocator
Note: See TracChangeset for help on using the changeset viewer.