Index: trunk/kernel/mm/vmm.c
===================================================================
--- trunk/kernel/mm/vmm.c	(revision 665)
+++ trunk/kernel/mm/vmm.c	(revision 672)
@@ -2,6 +2,6 @@
  * vmm.c - virtual memory manager related operations definition.
  *
- * Authors   Ghassan Almaless (2008,2009,2010,2011, 2012)
- *           Alain Greiner (2016,2017,2018,2019,2020)
+ * Authors   Ghassan Almaless (2008,2009,2010,2011,2012)
+ *           Alain Greiner    (2016,2017,2018,2019,2020)
  *
  * Copyright (c) UPMC Sorbonne Universites
@@ -63,5 +63,5 @@
 
 // check STACK zone
-assert( ((CONFIG_VMM_STACK_SIZE * CONFIG_THREADS_MAX_PER_CLUSTER) <=
+assert( __FUNCTION__, ((CONFIG_VMM_STACK_SIZE * CONFIG_THREADS_MAX_PER_CLUSTER) <=
 (CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE)) , "STACK zone too small\n");
 
@@ -89,5 +89,5 @@
 
 // check ltid argument
-assert( (ltid <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)),
+assert( __FUNCTION__, (ltid <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)),
 "slot index %d too large for an user stack vseg", ltid );
 
@@ -99,5 +99,5 @@
 
 // check requested slot is available
-assert( (bitmap_state( &mgr->bitmap , ltid ) == false),
+assert( __FUNCTION__, (bitmap_state( &mgr->bitmap , ltid ) == false),
 "slot index %d already allocated", ltid );
 
@@ -149,9 +149,9 @@
 
 // check index
-assert( (index <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)),
+assert( __FUNCTION__, (index <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)),
 "slot index %d too large for an user stack vseg", index );
 
 // check released slot is allocated
-assert( (bitmap_state( &mgr->bitmap , index ) == true),
+assert( __FUNCTION__, (bitmap_state( &mgr->bitmap , index ) == true),
 "released slot index %d non allocated", index );
 
@@ -226,9 +226,9 @@
 
 // check HEAP base and size 
-assert( (CONFIG_VMM_HEAP_BASE == 0x40000) & (CONFIG_VMM_STACK_BASE == 0xc0000),
+assert( __FUNCTION__, (CONFIG_VMM_HEAP_BASE == 0x40000) & (CONFIG_VMM_STACK_BASE == 0xc0000),
 "CONFIG_VMM_HEAP_BASE != 0x40000 or CONFIG_VMM_STACK_BASE != 0xc0000" );
 
 // check  MMAP vseg max order 
-assert( (CONFIG_VMM_HEAP_MAX_ORDER == 18), "max mmap vseg size is 256K pages" );
+assert( __FUNCTION__, (CONFIG_VMM_HEAP_MAX_ORDER == 18), "max mmap vseg size is 256K pages" );
 
     // get pointer on MMAP allocator 
@@ -252,5 +252,5 @@
     vseg_t * vseg0 = vseg_alloc();
 
-assert( (vseg0 != NULL) , "cannot allocate vseg" );
+assert( __FUNCTION__, (vseg0 != NULL) , "cannot allocate vseg" );
 
     vseg0->vpn_base = CONFIG_VMM_HEAP_BASE;
@@ -263,5 +263,5 @@
     vseg_t * vseg1 = vseg_alloc();
 
-assert( (vseg1 != NULL) , "cannot allocate vseg" );
+assert( __FUNCTION__, (vseg1 != NULL) , "cannot allocate vseg" );
 
     vseg1->vpn_base = CONFIG_VMM_HEAP_BASE << 1;
@@ -555,11 +555,9 @@
 
 // check UTILS zone 
-assert( ((CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE) <= 
-         (CONFIG_VMM_ELF_BASE - CONFIG_VMM_UTILS_BASE)) ,
-         "UTILS zone too small\n" );
+assert( __FUNCTION__ , ((CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE) <= 
+(CONFIG_VMM_ELF_BASE - CONFIG_VMM_UTILS_BASE)) , "UTILS zone too small\n" );
 
     // initialize lock protecting the VSL 
 	remote_queuelock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL );
-
 
     // initialize STACK allocator
@@ -577,45 +575,4 @@
 	vmm->global_pgfault_cost = 0;
 
-/*
-    // register "args" vseg in VSL
-    base = CONFIG_VMM_UTILS_BASE << CONFIG_PPM_PAGE_SHIFT;
-    size = CONFIG_VMM_ARGS_SIZE << CONFIG_PPM_PAGE_SHIFT;
-
-    vseg_args = vmm_create_vseg( process,
-                                 VSEG_TYPE_DATA,
-                                 base,
-                                 size,
-                                 0,             // file_offset unused
-                                 0,             // file_size unused
-                                 XPTR_NULL,     // mapper_xp unused
-                                 local_cxy );
-    if( vseg_args == NULL )
-    {
-        printk("\n[ERROR] in %s : cannot register args vseg\n", __FUNCTION__ );
-        return -1;
-    }
-
-    vmm->args_vpn_base = base;
-
-    // register "envs" vseg in VSL
-    base = (CONFIG_VMM_UTILS_BASE + CONFIG_VMM_ARGS_SIZE) << CONFIG_PPM_PAGE_SHIFT;
-    size = CONFIG_VMM_ENVS_SIZE << CONFIG_PPM_PAGE_SHIFT;
-
-    vseg_envs = vmm_create_vseg( process,
-                                 VSEG_TYPE_DATA,
-                                 base,
-                                 size,
-                                 0,             // file_offset unused
-                                 0,             // file_size unused
-                                 XPTR_NULL,     // mapper_xp unused
-                                 local_cxy );
-    if( vseg_envs == NULL )
-    {
-        printk("\n[ERROR] in %s : cannot register envs vseg\n", __FUNCTION__ );
-        return -1;
-    }
-
-    vmm->envs_vpn_base = base;
-*/
     hal_fence();
 
@@ -716,4 +673,7 @@
 // FIXME il faut gérer les process copies...
 
+    // re-initialise VMM
+    vmm_user_init( process );
+
 #if DEBUG_VMM_USER_RESET
 cycle = (uint32_t)hal_get_cycles();
@@ -1133,5 +1093,5 @@
 
 // check cluster is reference
-assert( (XPTR( local_cxy , process ) == process->ref_xp),
+assert( __FUNCTION__, (XPTR( local_cxy , process ) == process->ref_xp),
 "local cluster must be process reference cluster\n");
 
@@ -1869,6 +1829,6 @@
 
 // check arguments
-assert( (process != NULL), "process argument is NULL" );
-assert( (vseg    != NULL), "vseg argument is NULL" );
+assert( __FUNCTION__, (process != NULL), "process argument is NULL" );
+assert( __FUNCTION__, (vseg    != NULL), "vseg argument is NULL" );
 
     // get pointers on local process VMM 
@@ -1960,6 +1920,6 @@
 
 // check arguments
-assert( (process != NULL), "process argument is NULL" );
-assert( (vseg    != NULL), "vseg argument is NULL" );
+assert( __FUNCTION__, (process != NULL), "process argument is NULL" );
+assert( __FUNCTION__, (vseg    != NULL), "vseg argument is NULL" );
 
 #if DEBUG_VMM_RESIZE_VSEG
@@ -2228,5 +2188,5 @@
 
 // check vseg type
-assert( ( type != VSEG_TYPE_FILE ) , "illegal vseg type\n" );
+assert( __FUNCTION__, ( type != VSEG_TYPE_FILE ) , "illegal vseg type\n" );
 
     // compute target cluster identifier
@@ -2302,5 +2262,5 @@
         xptr_t mapper_xp = vseg->mapper_xp;
 
-assert( (mapper_xp != XPTR_NULL),
+assert( __FUNCTION__, (mapper_xp != XPTR_NULL),
 "mapper not defined for a FILE vseg\n" );
         
@@ -2327,5 +2287,5 @@
             xptr_t     mapper_xp = vseg->mapper_xp;
 
-assert( (mapper_xp != XPTR_NULL),
+assert( __FUNCTION__, (mapper_xp != XPTR_NULL),
 "mapper not defined for a CODE or DATA vseg\n" );
         
