Index: trunk/kernel/kern/cluster.c
===================================================================
--- trunk/kernel/kern/cluster.c	(revision 440)
+++ trunk/kernel/kern/cluster.c	(revision 443)
@@ -34,4 +34,5 @@
 #include <spinlock.h>
 #include <core.h>
+#include <chdev.h>
 #include <scheduler.h>
 #include <list.h>
@@ -49,8 +50,8 @@
 /////////////////////////////////////////////////////////////////////////////////////
 
-extern process_t process_zero;     // allocated in kernel_init.c file
-
-
-/////////////////////////////////////////////////
+extern process_t           process_zero;     // allocated in kernel_init.c file
+extern chdev_directory_t   chdev_dir;        // allocated in kernel_init.c file
+
+///////////////////////////////////////////////n
 error_t cluster_init( struct boot_info_s * info )
 {
@@ -252,4 +253,50 @@
 
 //////////////////////////////////////////////////////
+xptr_t cluster_get_process_from_pid_in_cxy( cxy_t cxy,
+                                            pid_t pid )
+{
+    xptr_t      root_xp;       // xptr on root of list of processes in owner cluster
+    xptr_t      lock_xp;       // xptr on lock protecting this list
+    xptr_t      iter_xp;       // iterator
+    xptr_t      current_xp;    // xptr on current process descriptor
+    bool_t      found;
+
+    cluster_t * cluster = LOCAL_CLUSTER;
+
+    // get owner cluster and lpid
+    cxy_t   owner_cxy = CXY_FROM_PID( pid );
+    lpid_t  lpid      = LPID_FROM_PID( pid );
+
+    // get lock & root of list of copies from owner cluster
+    root_xp = XPTR( owner_cxy , &cluster->pmgr.copies_root[lpid] );
+    lock_xp = XPTR( owner_cxy , &cluster->pmgr.copies_lock[lpid] );
+
+    // take the lock protecting the list of processes
+    remote_spinlock_lock( lock_xp );
+
+    // scan list of processes
+    found = false;
+    XLIST_FOREACH( root_xp , iter_xp )
+    {
+        current_xp  = XLIST_ELEMENT( iter_xp , process_t , copies_list );
+
+        if( GET_CXY( current_xp ) == cxy )
+        {
+            found = true;
+            break;
+        }
+    }
+
+    // release the lock protecting the list of processes
+    remote_spinlock_unlock( lock_xp );
+
+    // return extended pointer on process descriptor in owner cluster
+    if( found ) return current_xp;
+    else        return XPTR_NULL;
+
+}  // end cluster_get_process_from_pid_in_cxy()
+
+
+//////////////////////////////////////////////////////
 xptr_t cluster_get_owner_process_from_pid( pid_t pid )
 {
@@ -298,4 +345,5 @@
 }  // end cluster_get_owner_process_from_pid()
 
+
 //////////////////////////////////////////////////////////
 xptr_t cluster_get_reference_process_from_pid( pid_t pid )
@@ -459,16 +507,21 @@
 void cluster_process_local_link( process_t * process )
 {
-    uint32_t irq_state;
+    reg_t    save_sr;
+
     pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
 
+    // get extended pointers on local process list root & lock
+    xptr_t root_xp = XPTR( local_cxy , &pm->local_root );
+    xptr_t lock_xp = XPTR( local_cxy , &pm->local_lock );
+
     // get lock protecting the process manager local list
-    remote_spinlock_lock_busy( XPTR( local_cxy , &pm->local_lock ) , & irq_state );
-
-    xlist_add_last( XPTR( local_cxy , &pm->local_root ),
-                    XPTR( local_cxy , &process->local_list ) );
+    remote_spinlock_lock_busy( lock_xp , &save_sr );
+
+    // register process in local list
+    xlist_add_last( root_xp , XPTR( local_cxy , &process->local_list ) );
     pm->local_nr++;
 
     // release lock protecting the process manager local list
-    remote_spinlock_unlock_busy( XPTR( local_cxy , &pm->local_lock ) , irq_state );
+    remote_spinlock_unlock_busy( lock_xp , save_sr );
 }
 
@@ -476,15 +529,20 @@
 void cluster_process_local_unlink( process_t * process )
 {
-    uint32_t irq_state;
+    reg_t save_sr;
+
     pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
 
+    // get extended pointers on local process list lock
+    xptr_t lock_xp = XPTR( local_cxy , &pm->local_lock );
+
     // get lock protecting the process manager local list
-    remote_spinlock_lock_busy( XPTR( local_cxy , &pm->local_lock ) , &irq_state );
-
+    remote_spinlock_lock_busy( lock_xp , &save_sr );
+
+    // remove process from local list
     xlist_unlink( XPTR( local_cxy , &process->local_list ) );
     pm->local_nr--;
 
     // release lock protecting the process manager local list
-    remote_spinlock_unlock_busy( XPTR( local_cxy , &pm->local_lock ) , irq_state );
+    remote_spinlock_unlock_busy( lock_xp , save_sr );
 }
 
@@ -582,14 +640,39 @@
 {
     xptr_t        root_xp;
+    xptr_t        lock_xp;
     xptr_t        iter_xp;
-    xptr_t        process_xp;     
-
-    // get extended pointer on root of process in cluster cxy
+    xptr_t        process_xp;
+    cxy_t         txt0_cxy;
+    chdev_t     * txt0_ptr;
+    xptr_t        txt0_xp;
+    xptr_t        txt0_lock_xp;
+    reg_t         txt0_save_sr;     // save SR to take TXT0 lock in busy mode      
+
+    assert( (cluster_is_undefined( cxy ) == false),
+    __FUNCTION__, "illegal cluster index" );
+
+    // get extended pointer on root and lock for local process list in cluster
     root_xp = XPTR( cxy , &LOCAL_CLUSTER->pmgr.local_root );
-
-    // skip one line
-    printk("\n***** processes in cluster %x / cycle %d\n", cxy , (uint32_t)hal_get_cycles() );
-
-    // loop on all reference processes in cluster cxy 
+    lock_xp = XPTR( cxy , &LOCAL_CLUSTER->pmgr.local_lock );
+
+    // get pointers on TXT0 chdev
+    txt0_xp  = chdev_dir.txt_tx[0];
+    txt0_cxy = GET_CXY( txt0_xp );
+    txt0_ptr = GET_PTR( txt0_xp );
+
+    // get extended pointer on TXT0 lock
+    txt0_lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock );
+
+    // get lock on local process list 
+    remote_spinlock_lock( lock_xp );
+
+    // get TXT0 lock in busy waiting mode
+    remote_spinlock_lock_busy( txt0_lock_xp , &txt0_save_sr );
+     
+    // display header
+    nolock_printk("\n***** processes in cluster %x / cycle %d\n",
+    cxy , (uint32_t)hal_get_cycles() );
+
+    // loop on all processes in cluster cxy 
     XLIST_FOREACH( root_xp , iter_xp )
     {
@@ -597,4 +680,11 @@
         process_display( process_xp );
     }
+
+    // release TXT0 lock in busy waiting mode
+    remote_spinlock_unlock_busy( txt0_lock_xp , txt0_save_sr );
+
+    // release lock on local process list
+    remote_spinlock_unlock( lock_xp );
+
 }  // end cluster_processes_display() 
 
