Index: trunk/kernel/kern/process.c
===================================================================
--- trunk/kernel/kern/process.c	(revision 188)
+++ trunk/kernel/kern/process.c	(revision 204)
@@ -112,4 +112,8 @@
     }
 
+    // initialize PID and PPID
+	process->pid   = pid;
+    process->ppid  = parent_pid;
+
     // reset reference process vmm (not for kernel process)
     if( pid ) vmm_init( process );
@@ -152,8 +156,4 @@
     spinlock_init( &process->th_lock );
 
-    // initialize PID and PPID
-	process->pid   = pid;
-    process->ppid  = parent_pid;
-
     // set ref_xp field
     process->ref_xp = XPTR( local_cxy , process );
@@ -171,5 +171,6 @@
     process_dmsg("\n[INFO] %s : exit for process %x in cluster %x\n",
                  __FUNCTION__ , pid );
-}
+
+}  // process_reference init()
 
 /////////////////////////////////////////////////////
@@ -230,5 +231,6 @@
 
     return 0;
-}
+
+} // end process_copy_init()
 
 ///////////////////////////////////////////
@@ -578,5 +580,7 @@
 
     return (found) ? 0 : ENOMEM;
-}
+
+}  // end process_register_thread()
+
 ///////////////////////////////////////////////
 void process_remove_thread( thread_t * thread )
@@ -596,5 +600,6 @@
     process->th_tbl[ltid] = NULL;
     process->th_nr--;
-}
+
+}  // process_remove_thread()
 
 /////////////////////////////////////////////////////
@@ -623,5 +628,5 @@
     parent_pid = hal_remote_lw( XPTR( parent_cxy , &parent_ptr->pid ) );
 
-    exec_dmsg("\n[INFO] %s enters in cluster %x for path = %s\n",
+    exec_dmsg("\n[INFO] %s : enters in cluster %x for path = %s\n",
                 __FUNCTION__ , local_cxy , path );
 
@@ -650,6 +655,6 @@
     process_reference_init( process , pid , parent_xp );
 
-    exec_dmsg("\n[INFO] %s created process %x cluster %x / path = %s\n",
-                __FUNCTION__, parent_pid , local_cxy , path );
+    exec_dmsg("\n[INFO] %s : created process %x in cluster %x / path = %s\n",
+                __FUNCTION__, pid , local_cxy , path );
 
     // initialize vfs_root and vfs_cwd from parent process
@@ -663,15 +668,12 @@
 
     // initialize embedded fd_array from parent process
-    process_fd_remote_copy( XPTR( local_cxy , &process->fd_array ),
+    process_fd_remote_copy( XPTR( local_cxy  , &process->fd_array ),
                             XPTR( parent_cxy , &parent_ptr->fd_array) );
+
+    exec_dmsg("\n[INFO] %s : fd_array copied from process %x to process %x\n",
+                __FUNCTION__, parent_pid , pid );
 
 	// initialize signal manager TODO ??? [AG]
 	// signal_manager_init( process );
-
-    // initialize process VMM
-	vmm_init( process );
-
-    exec_dmsg("\n[INFO] %s initialized VMM in cluster %x for process %x / path = %s\n",
-                __FUNCTION__ , local_cxy , pid , path );
 
     // register "code" and "data" vsegs as well as the process entry-point in VMM,
@@ -687,16 +689,6 @@
 	}
 
-    // register "heap" vseg descriptor in VMM
-    vseg_t * heap_vseg = vmm_create_vseg( process,
-                                          CONFIG_VMM_HEAP_BASE,
-                                          CONFIG_VMM_HEAP_SIZE,
-                                          VSEG_TYPE_HEAP );
-    if( heap_vseg == NULL )
-	{
-		printk("\n[ERROR] in %s : cannot create heap vseg for process %x / path = %s\n",
-		       __FUNCTION__, pid , path );
-        process_destroy( process );
-        return error;
-	}
+    exec_dmsg("\n[INFO] %s : code and data vsegs from <%s> registered for process %x\n",
+                __FUNCTION__ , path , pid );
 
     // select a core in cluster
@@ -718,8 +710,11 @@
 	{
 		printk("\n[ERROR] in %s : cannot create thread for process %x / path = %s\n",
-		       __FUNCTION__, pid , path );
+		       __FUNCTION__, pid );
         process_destroy( process );
         return error;
 	}
+
+	exec_dmsg("\n[INFO] %s : thread created for process %x on core %d in cluster %x\n",
+               __FUNCTION__ , pid , core->lid , local_cxy );
 
     // update children list in parent process
@@ -731,12 +726,13 @@
 	sched_register_thread( core , thread );
 
-	exec_dmsg("\n[INFO] %s created thread for process %x on core %d in cluster %x\n",
-               __FUNCTION__ , pid , core->lid , local_cxy );
-
     // activate new thread
 	thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_GLOBAL );
 
+    exec_dmsg("\n[INFO] %s : exit for process %x\n",
+                __FUNCTION__, process->pid );
+
 	return 0;
-}
+
+}  // end proces_make_exec()
 
 //////////////////////////
@@ -755,5 +751,5 @@
     uint32_t  stderr_id;
 
-	process_dmsg("\n[INFO] %s enters in cluster %x\n", __FUNCTION__ , local_cxy );
+	process_dmsg("\n[INFO] %s : enters in cluster %x\n", __FUNCTION__ , local_cxy );
 
     // open stdin / stdout / stderr pseudo-files
@@ -762,24 +758,9 @@
 	error3 = vfs_open( XPTR_NULL, CONFIG_DEV_STDERR, O_WRONLY, 0, &stderr_xp, &stderr_id );
 
-	if( error1 || error2 || error3 )
-	{
-		if( !error1 ) vfs_close( stdin_xp  , stdin_id );
-		if( !error2 ) vfs_close( stdout_xp , stdout_id );
-		if( !error3 ) vfs_close( stderr_xp , stderr_id );
-		printk("\n[PANIC] in %s : cannot open stdin/stdout/stderr in cluster %x\n",
-               __FUNCTION__ , local_cxy );
-        hal_core_sleep();
-	}
-
-    // check stdin / stdout / stderr indexes
-    if( (stdin_id != 0) || (stdout_id != 1) || (stderr_id != 2) )
-    {
-		vfs_close( stdin_xp  , stdin_id );
-		vfs_close( stdout_xp , stdout_id );
-		vfs_close( stderr_xp , stderr_id );
-		printk("\n[PANIC] in %s : bad indexes for stdin/stdout/stderr in cluster %x\n",
-            __FUNCTION__ , local_cxy );
-        hal_core_sleep();
-    }
+	assert( ((error1 == 0) && (error2 == 0) && (error3 == 0)) , __FUNCTION__ ,
+            "cannot open stdin/stdout/stderr pseudo files\n");
+
+    assert( ((stdin_id == 0) && (stdout_id == 1) && (stderr_id == 2)) , __FUNCTION__ ,
+            "bad indexes for stdin/stdout/stderr\n");
 
     // initialize the exec_info structure
@@ -792,14 +773,10 @@
 	error1 = process_make_exec( &exec_info );
 
-	if( error1 )
-	{
-        printk("\n[PANIC] in %s : cannot create main thread in cluster %x\n",
-               __FUNCTION__ , local_cxy );
-		hal_core_sleep();
-    }
-
-	process_dmsg("\n[INFO] %s successfully exit in cluster %x\n", __FUNCTION__ , local_cxy );
+	assert( (error1 == 0) , __FUNCTION__ , "cannot create process_init\n");
+
+	process_dmsg("\n[INFO] %s : exit in cluster %x\n", __FUNCTION__ , local_cxy );
 		
     hal_fence();
-}
-
+
+}  // end process_init_create()
+
