Index: trunk/kernel/kern/rpc.c
===================================================================
--- trunk/kernel/kern/rpc.c	(revision 450)
+++ trunk/kernel/kern/rpc.c	(revision 457)
@@ -23,5 +23,5 @@
 
 #include <kernel_config.h>
-#include <hal_types.h>
+#include <hal_kernel_types.h>
 #include <hal_atomic.h>
 #include <hal_remote.h>
@@ -100,20 +100,18 @@
     volatile error_t   full;
     thread_t         * this;
-    cluster_t        * cluster;
-
-#if DEBUG_RPC_CLIENT_GENERIC
-uint32_t cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[DBG] %s : thread %x in cluster %x enter for rpc[%d] / rpc_ptr %x / cycle %d\n",
-__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, rpc, cycle );
-#endif
 
     full            = 0;
     this            = CURRENT_THREAD;
-    cluster         = LOCAL_CLUSTER;
     client_core_lid = this->core->lid;
 
+#if DEBUG_RPC_CLIENT_GENERIC
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
+printk("\n[DBG] %s : thread %x in process %x enter for rpc[%d] / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
+#endif
+
     // select a server_core : use client core index if possible / core 0 otherwise
-    if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &cluster->cores_nr ) ) )
+    if( client_core_lid < hal_remote_lw( XPTR( server_cxy , &LOCAL_CLUSTER->cores_nr ) ) )
     {
         server_core_lid = client_core_lid;
@@ -150,7 +148,14 @@
  
     hal_fence();
+
+#if DEBUG_RPC_CLIENT_GENERIC
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
+printk("\n[DBG] %s : thread %x in process %x / rpc[%d] / rpc_ptr %x / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index, rpc, cycle );
+#endif
 	
-    // send IPI to the selected server core
-	dev_pic_send_ipi( server_cxy , server_core_lid );
+   // send IPI to the selected server core
+   dev_pic_send_ipi( server_cxy , server_core_lid );
 
     // wait RPC completion before returning if blocking RPC
@@ -165,6 +170,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[DBG] %s : thread %x in cluster %x busy waiting / rpc[%d] / cycle %d\n",
-__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle );
+printk("\n[DBG] %s : thread %x in process %x busy waiting for rpc[%d] / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle );
 #endif
 
@@ -174,6 +179,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[DBG] %s : thread %x in cluster %x resumes / rpc[%d] / cycle %d\n",
-__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle );
+printk("\n[DBG] %s : thread %x in process %x resumes for rpc[%d] / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
 #endif
         } 
@@ -184,6 +189,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[DBG] %s : thread %x in cluster %x blocks & deschedules / rpc[%d] / cycle %d\n",
-__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index , cycle );
+printk("\n[DBG] %s : thread %x in process %x blocks & deschedules for rpc[%d] / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle );
 #endif
             thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_RPC );
@@ -193,6 +198,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[DBG] %s : thread %x in cluster %x resumes / rpcr[%d] / cycle %d\n",
-__FUNCTION__, CURRENT_THREAD, local_cxy, rpc->index, cycle );
+printk("\n[DBG] %s : thread %x in process %x resumes for rpc[%d] / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
 #endif
         }
@@ -207,6 +212,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[DBG] %s : non blocking rpc[%d] => thread %x return  / cycle %d\n",
-__FUNCTION__, rpc->index, CURRENT_THREAD, cycle );
+printk("\n[DBG] %s : thread %x in process %x returns for non blocking rpc[%d] / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
 #endif
 
@@ -225,4 +230,8 @@
     thread_t      * thread;  
     uint32_t        sr_save;
+
+#if DEBUG_RPC_SERVER_GENERIC
+uint32_t cycle;
+#endif
 
     bool_t          found    = false;
@@ -232,11 +241,4 @@
 	remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[core->lid];
 
-#if DEBUG_RPC_SERVER_GENERIC
-uint32_t cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : thread %x interrupted in cluster %x / cycle %d\n",
-__FUNCTION__, this, local_cxy, cycle );
-#endif
-
     // interrupted thread not preemptable during RPC chek
 	hal_disable_irq( &sr_save );
@@ -249,6 +251,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC FIFO non empty in cluster %x / cycle %d\n",
-__FUNCTION__, local_cxy, cycle );
+printk("\n[DBG] %s : RPC FIFO non empty for core[%x,%d] / cycle %d\n",
+__FUNCTION__, local_cxy, core->lid, cycle );
 #endif
 
@@ -290,6 +292,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : create a new RPC thread %x in cluster %x / cycle %d\n",
-__FUNCTION__, thread, local_cxy, cycle );
+printk("\n[DBG] %s : new RPC thread %x created for core[%x,%d] / cycle %d\n",
+__FUNCTION__, thread, local_cxy, core->lid, cycle );
 #endif
         }
@@ -299,6 +301,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : interrupted thread %x deschedules in cluster %x / cycle %d\n",
-__FUNCTION__, this, local_cxy, cycle );
+printk("\n[DBG] %s : interrupted thread %x deschedules on core[%x,%d] / cycle %d\n",
+__FUNCTION__, this, local_cxy, core->lid, cycle );
 #endif
 
@@ -309,6 +311,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : interrupted thread %x resumes in cluster %x / cycle %d\n",
-__FUNCTION__, this, local_cxy, cycle );
+printk("\n[DBG] %s : interrupted thread %x resumes on core[%x,%d] / cycle %d\n",
+__FUNCTION__, this, local_cxy, core->lid, cycle );
 #endif
 
@@ -410,5 +412,5 @@
 #endif
                         // send IPI to client core
-	                    dev_pic_send_ipi( desc_cxy , client_core_lid );
+	                    // dev_pic_send_ipi( desc_cxy , client_core_lid );
                     }
 		        }
@@ -872,5 +874,5 @@
 pid_t     pid    = rpc->args[1];
 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
-printk("\n[DBG] %s : enter to %s process %x in cluster %x / cycle %d\n",
+printk("\n[DBG] %s : enter to request %s of process %x in cluster %x / cycle %d\n",
 __FUNCTION__ , process_action_str( action ) , pid , cxy , cycle );
 #endif
@@ -949,5 +951,5 @@
 
         // send an IPI to client core
-        dev_pic_send_ipi( client_cxy , client_lid );
+        // dev_pic_send_ipi( client_cxy , client_lid );
     }
 
