Index: trunk/kernel/kern/process.c
===================================================================
--- trunk/kernel/kern/process.c	(revision 564)
+++ trunk/kernel/kern/process.c	(revision 580)
@@ -112,4 +112,6 @@
     cxy_t       chdev_cxy;
     pid_t       parent_pid;
+    lpid_t      process_lpid;
+    lpid_t      parent_lpid;
 
     // get parent process cluster and local pointer
@@ -119,4 +121,8 @@
     // get parent_pid
     parent_pid = hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid ) );
+
+    // get process and parent lpid
+    process_lpid = LPID_FROM_PID( pid );
+    parent_lpid  = LPID_FROM_PID( parent_pid ); 
 
 #if DEBUG_PROCESS_REFERENCE_INIT
@@ -150,9 +156,10 @@
 
     // define the stdin/stdout/stderr pseudo files <=> select a TXT terminal.
-    if( (pid == 1) || (parent_pid == 1)) // INIT or KSH process
+    if( (process_lpid == 1) ||     // INIT process
+        (parent_lpid  == 1) )      // KSH  process
     {
         // allocate a TXT channel
-        if( pid == 1 )  txt_id = 0;                     // INIT
-        else            txt_id = process_txt_alloc();   // KSH
+        if( process_lpid == 1 )  txt_id = 0;                     // INIT
+        else                     txt_id = process_txt_alloc();   // KSH
 
         // attach process to TXT
@@ -1487,4 +1494,6 @@
 void process_zero_create( process_t * process )
 {
+    error_t error;
+    pid_t   pid;
 
 #if DEBUG_PROCESS_ZERO_CREATE
@@ -1495,9 +1504,21 @@
 #endif
 
+    // get PID from local cluster manager for this kernel process
+    error = cluster_pid_alloc( process , &pid );
+
+    if( error || (LPID_FROM_PID( pid ) != 0) )
+    {
+        printk("\n[PANIC] in %s : cannot get valid PID in cluster %x / PID = %x\n",
+        __FUNCTION__ , local_cxy, pid );
+        hal_core_sleep();
+    }
+
     // initialize PID, REF_XP, PARENT_XP, and STATE
-    process->pid        = 0;
+    // the kernel process_zero is its own parent_process,
+    // reference_process, and owner_process, and cannot be killed...
+    process->pid        = pid;
     process->ref_xp     = XPTR( local_cxy , process );
     process->owner_xp   = XPTR( local_cxy , process );
-    process->parent_xp  = XPTR_NULL;
+    process->parent_xp  = XPTR( local_cxy , process );
     process->term_state = 0;
 
@@ -1518,4 +1539,7 @@
                            LOCK_PROCESS_CHILDREN );
 
+    // register kernel process in cluster manager local_list
+    cluster_process_local_link( process );
+    
 	hal_fence();
 
@@ -1686,4 +1710,5 @@
     pid_t         pid;
     pid_t         ppid;
+    lpid_t        lpid;
     uint32_t      state;
     uint32_t      th_nr;
@@ -1707,9 +1732,10 @@
     process_cxy = GET_CXY( process_xp );
 
-    // get PID and state
+    // get process PID, LPID, and state
     pid   = hal_remote_l32( XPTR( process_cxy , &process_ptr->pid ) );
+    lpid  = LPID_FROM_PID( pid );
     state = hal_remote_l32( XPTR( process_cxy , &process_ptr->term_state ) );
 
-    // get PPID
+    // get process PPID
     parent_xp  = hal_remote_l64( XPTR( process_cxy , &process_ptr->parent_xp ) );
     parent_cxy = GET_CXY( parent_xp );
@@ -1725,28 +1751,40 @@
     owner_ptr = GET_PTR( owner_xp );
 
-    // get extended pointer on TXT_RX file descriptor attached to process
-    txt_file_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) );
-
-    assert( (txt_file_xp != XPTR_NULL) ,
-    "process must be attached to one TXT terminal\n" ); 
-
-    // get TXT_RX chdev pointers
-    txt_chdev_xp  = chdev_from_file( txt_file_xp );
-    txt_chdev_cxy = GET_CXY( txt_chdev_xp );
-    txt_chdev_ptr = GET_PTR( txt_chdev_xp );
-
-    // get TXT_RX name and ownership
-    hal_remote_strcpy( XPTR( local_cxy , txt_name ) ,
-                       XPTR( txt_chdev_cxy , txt_chdev_ptr->name ) );
+    // get process TXT name and .elf name
+    if( lpid )                                   // user process
+    {
+
+        // get extended pointer on file descriptor associated to TXT_RX 
+        txt_file_xp = hal_remote_l64( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) );
+
+        assert( (txt_file_xp != XPTR_NULL) ,
+        "process must be attached to one TXT terminal\n" ); 
+
+        // get TXT_RX chdev pointers
+        txt_chdev_xp  = chdev_from_file( txt_file_xp );
+        txt_chdev_cxy = GET_CXY( txt_chdev_xp );
+        txt_chdev_ptr = GET_PTR( txt_chdev_xp );
+
+        // get TXT_RX name and ownership
+        hal_remote_strcpy( XPTR( local_cxy , txt_name ) ,
+                           XPTR( txt_chdev_cxy , txt_chdev_ptr->name ) );
     
-    txt_owner_xp = (xptr_t)hal_remote_l64( XPTR( txt_chdev_cxy, 
-                                                 &txt_chdev_ptr->ext.txt.owner_xp ) );
-    
-    // get process .elf name
-    elf_file_xp   = hal_remote_l64( XPTR( process_cxy , &process_ptr->vfs_bin_xp ) );
-    elf_file_cxy  = GET_CXY( elf_file_xp );
-    elf_file_ptr  = (vfs_file_t *)GET_PTR( elf_file_xp );
-    elf_inode_ptr = (vfs_inode_t *)hal_remote_lpt( XPTR( elf_file_cxy , &elf_file_ptr->inode ) );
-    vfs_inode_get_name( XPTR( elf_file_cxy , elf_inode_ptr ) , elf_name );
+        txt_owner_xp = (xptr_t)hal_remote_l64( XPTR( txt_chdev_cxy, 
+                                                     &txt_chdev_ptr->ext.txt.owner_xp ) );
+
+        // get process .elf name
+        elf_file_xp   = hal_remote_l64( XPTR( process_cxy , &process_ptr->vfs_bin_xp ) );
+        elf_file_cxy  = GET_CXY( elf_file_xp );
+        elf_file_ptr  = GET_PTR( elf_file_xp );
+        elf_inode_ptr = hal_remote_lpt( XPTR( elf_file_cxy , &elf_file_ptr->inode ) );
+        vfs_inode_get_name( XPTR( elf_file_cxy , elf_inode_ptr ) , elf_name );
+    }
+    else                                         // kernel process_zero
+    {
+        // TXT name and .elf name are not registered in kernel process_zero
+        strcpy( txt_name , "txt0_rx" );
+        txt_owner_xp = process_xp; 
+        strcpy( elf_name , "kernel.elf" );
+    }
 
     // display process info
