Index: trunk/kernel/kern/rpc.c
===================================================================
--- trunk/kernel/kern/rpc.c	(revision 614)
+++ trunk/kernel/kern/rpc.c	(revision 619)
@@ -143,5 +143,5 @@
     client_core_lid = this->core->lid;
 
-    // check calling thread can yield when client thread is not the IDLE thread
+    // check calling thread can yield when is not the IDLE thread
     // RPCs executed by the IDLE thread during kernel_init do not deschedule
     if( this->type != THREAD_IDLE ) thread_assert_can_yield( this , __FUNCTION__ );
@@ -184,6 +184,4 @@
     while( full );
  
-    hal_fence();
-
 #if DEBUG_RPC_CLIENT_GENERIC
 uint32_t cycle = (uint32_t)hal_get_cycles();
@@ -199,5 +197,5 @@
 
     // wait RPC completion before returning if blocking RPC :
-    // - descheduling without blocking if thread idle (in kernel init)
+    // - deschedule without blocking if thread idle (in kernel init)
     // - block and deschedule policy for any other thread
     if ( rpc->blocking )
@@ -212,7 +210,13 @@
 __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle );
 #endif
-
-             while( rpc->responses ) sched_yield( "busy waiting on RPC");
-    
+             while( 1 )
+             {
+                 // check responses counter
+                 if( hal_remote_l32( XPTR( local_cxy , rpc->rsp ) ) == 0 ) break;
+                   
+                 // deschedule
+                 sched_yield("busy_waiting RPC completion");
+             }
+
 #if DEBUG_RPC_CLIENT_GENERIC
 cycle = (uint32_t)hal_get_cycles();
@@ -242,5 +246,5 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < cycle ) 
-printk("\n[%s] thread[%x,%x] resumes for rpc %s / cycle %d\n",
+printk("\n[%s] thread[%x,%x] resumes after rpc %s / cycle %d\n",
 __FUNCTION__, this->process->pid, this->trdid, rpc_str[rpc->index], cycle );
 #endif
@@ -248,5 +252,5 @@
 
 // response must be available for a blocking RPC
-assert( (rpc->responses == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] );
+assert( (*rpc->rsp == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] );
 
     }
@@ -270,5 +274,5 @@
 
 ////////////////////////////
-void rpc_thread_func( void )
+void rpc_server_func( void )
 {
     error_t         empty;              // local RPC fifo state
@@ -278,12 +282,14 @@
     uint32_t        index;              // RPC request index 
     thread_t      * client_ptr;         // local pointer on client thread
+    xptr_t          client_xp;          // extended pointer on client thread
+    lid_t           client_lid;         // local index of client core
 	thread_t      * server_ptr;         // local pointer on server thread
     xptr_t          server_xp;          // extended pointer on server thread
-    lid_t           client_core_lid;    // local index of client core
-    lid_t           server_core_lid;    // local index of server core
-    bool_t          blocking;           // blocking RPC when true
+    lid_t           server_lid;         // local index of server core
 	remote_fifo_t * rpc_fifo;           // local pointer on RPC fifo
-    uint32_t        count;              // current number of expected responses
- 
+    uint32_t      * rsp_ptr;            // local pointer on responses counter
+    xptr_t          rsp_xp;             // extended pointer on responses counter
+    uint32_t        responses;          // number of expected responses
+
     // makes RPC thread not preemptable
 	hal_disable_irq( NULL );
@@ -291,6 +297,6 @@
 	server_ptr      = CURRENT_THREAD;
     server_xp       = XPTR( local_cxy , server_ptr );
-    server_core_lid = server_ptr->core->lid;
-	rpc_fifo        = &LOCAL_CLUSTER->rpc_fifo[server_core_lid];
+    server_lid      = server_ptr->core->lid;
+	rpc_fifo        = &LOCAL_CLUSTER->rpc_fifo[server_lid];
 
     // "infinite" RPC thread loop
@@ -305,5 +311,5 @@
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
 printk("\n[%s] RPC thread[%x,%x] on core[%d] takes RPC_FIFO ownership / cycle %d\n",
-__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_core_lid, cycle );
+__FUNCTION__, server_ptr->process->pid, server_ptr->trdid, server_lid, cycle );
 #endif
 	        // try to consume one RPC request  
@@ -320,7 +326,12 @@
                 desc_ptr = GET_PTR( desc_xp );
 
+                // get relevant infos from RPC descriptor
 	            index      = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->index ) );
-                blocking   = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->blocking ) );
                 client_ptr = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );
+                rsp_ptr    = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->rsp ) );
+                client_lid = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->lid ) );
+
+                rsp_xp     = XPTR( desc_cxy , rsp_ptr );
+                client_xp  = XPTR( desc_cxy , client_ptr );
 
 #if DEBUG_RPC_SERVER_GENERIC
@@ -332,5 +343,5 @@
 #endif
                 // register client thread in RPC thread descriptor
-                server_ptr->rpc_client_xp = XPTR( desc_cxy , client_ptr );
+                server_ptr->rpc_client_xp = client_xp;
  
                 // call the relevant server function
@@ -343,16 +354,12 @@
 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, rpc_str[index], desc_cxy, cycle );
 #endif
-                // decrement expected responses counter in RPC descriptor
-                count = hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->responses ), -1 );
-
-                // decrement response counter in RPC descriptor if last response
-                if( count == 1 ) 
+                // decrement expected responses counter 
+                responses = hal_remote_atomic_add( rsp_xp , -1 );
+
+                // unblock client thread if last response
+                if( responses == 1 ) 
                 {
-                    // get client thread pointer and client core lid from RPC descriptor
-                    client_ptr      = hal_remote_lpt( XPTR( desc_cxy , &desc_ptr->thread ) );
-                    client_core_lid = hal_remote_l32 ( XPTR( desc_cxy , &desc_ptr->lid ) );
-
                     // unblock client thread
-                    thread_unblock( XPTR( desc_cxy , client_ptr ) , THREAD_BLOCKED_RPC );
+                    thread_unblock( client_xp , THREAD_BLOCKED_RPC );
 
                     hal_fence();
@@ -360,11 +367,14 @@
 #if DEBUG_RPC_SERVER_GENERIC
 cycle = (uint32_t)hal_get_cycles();
+trdid_t     client_trdid = hal_remote_l32( XPTR( desc_cxy , &client_ptr->trdid ) );
+process_t * process      = hal_remote_lpt( XPTR( desc_cxy , &client_ptr->process ) );
+pid_t       client_pid   = hal_remote_l32( XPTR( desc_cxy , &process->pid ) );
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
 printk("\n[%s] RPC thread[%x,%x] unblocked client thread[%x,%x] / cycle %d\n",
 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid,
-client_ptr->process->pid, client_ptr->trdid, cycle );
+client_pid, client_trdid, cycle );
 #endif
                     // send IPI to client core
-                    dev_pic_send_ipi( desc_cxy , client_core_lid );
+                    dev_pic_send_ipi( desc_cxy , client_lid );
                 }
             }  // end RPC handling if fifo non empty
@@ -372,5 +382,5 @@
 
         // sucide if too many RPC threads 
-        if( LOCAL_CLUSTER->rpc_threads[server_core_lid] >= CONFIG_RPC_THREADS_MAX )
+        if( LOCAL_CLUSTER->rpc_threads[server_lid] >= CONFIG_RPC_THREADS_MAX )
 	    {
 
@@ -382,5 +392,5 @@
 #endif
             // update RPC threads counter
-	        hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_core_lid] , -1 );
+	        hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_lid] , -1 );
 
             // RPC thread blocks on GLOBAL
@@ -397,5 +407,5 @@
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[%s] RPC thread[%x,%x] block IDLE & deschedules / cycle %d\n",
+printk("\n[%s] RPC thread[%x,%x] blocks & deschedules / cycle %d\n",
 __FUNCTION__, server_ptr->process->pid, server_ptr->trdid, cycle );
 #endif
@@ -407,5 +417,6 @@
         }
 	} // end infinite loop
-} // end rpc_thread_func()
+
+} // end rpc_server_func()
 
 
@@ -427,5 +438,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -433,5 +444,5 @@
     rpc.index     = RPC_PMEM_GET_PAGES;
     rpc.blocking  = true;
-    rpc.responses = 1;
+    rpc.rsp       = &responses;
 
     // set input arguments in RPC descriptor 
@@ -485,5 +496,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [1]       Marshaling functions attached to RPC_PMEM_RELEASE_PAGES (blocking)
+// [1]       Marshaling functions attached to RPC_PMEM_RELEASE_PAGES 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -500,5 +511,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -506,5 +517,5 @@
     rpc.index    = RPC_PMEM_RELEASE_PAGES;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -559,5 +570,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [3]           Marshaling functions attached to RPC_PROCESS_MAKE_FORK (blocking)
+// [3]           Marshaling functions attached to RPC_PROCESS_MAKE_FORK 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -578,5 +589,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -584,5 +595,5 @@
     rpc.index    = RPC_PROCESS_MAKE_FORK;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor  
@@ -651,5 +662,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [4]      Marshaling functions attached to RPC_USER_DIR_CREATE (blocking) 
+// [4]      Marshaling functions attached to RPC_USER_DIR_CREATE  
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -668,5 +679,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -674,5 +685,5 @@
     rpc.index    = RPC_USER_DIR_CREATE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -732,5 +743,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [5]      Marshaling functions attached to RPC_USER_DIR_DESTROY (blocking) 
+// [5]      Marshaling functions attached to RPC_USER_DIR_DESTROY 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -748,5 +759,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -754,5 +765,5 @@
     rpc.index    = RPC_USER_DIR_DESTROY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -805,5 +816,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [6]      Marshaling functions attached to RPC_THREAD_USER_CREATE (blocking)  
+// [6]      Marshaling functions attached to RPC_THREAD_USER_CREATE   
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -824,6 +835,6 @@
 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
 #endif
-
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+   
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -831,5 +842,5 @@
     rpc.index    = RPC_THREAD_USER_CREATE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -929,5 +940,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -935,5 +946,5 @@
     rpc.index    = RPC_THREAD_KERNEL_CREATE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1007,10 +1018,11 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [9]   Marshaling functions attached to RPC_PROCESS_SIGACTION (non blocking)
+// [9]   Marshaling functions attached to RPC_PROCESS_SIGACTION 
 /////////////////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////
 void rpc_process_sigaction_client( cxy_t        cxy,
-                                   rpc_desc_t * rpc )
+                                   pid_t        pid,
+                                   uint32_t     action )
 {
 #if DEBUG_RPC_PROCESS_SIGACTION
@@ -1018,20 +1030,30 @@
 thread_t * this = CURRENT_THREAD;
 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
-printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
-#endif
-
-// check RPC "index" and "blocking" arguments
-assert( (rpc->blocking == false) , "must be non-blocking\n");
-assert( (rpc->index == RPC_PROCESS_SIGACTION ) , "bad RPC index\n" );
-
-    // register RPC request in remote RPC fifo and return
-    rpc_send( cxy , rpc );
+printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
+process_action_str( action ), pid, cycle );
+#endif
+
+    uint32_t    responses = 1;
+    rpc_desc_t  rpc;
+
+    // initialise RPC descriptor header 
+    rpc.index    = RPC_PROCESS_SIGACTION;
+    rpc.blocking = true;
+    rpc.rsp      = &responses;
+
+    // set input arguments in RPC descriptor 
+    rpc.args[0] = (uint64_t)pid;
+    rpc.args[1] = (uint64_t)action;
+
+    // register RPC request in remote RPC fifo 
+    rpc_send( cxy , &rpc );
 
 #if DEBUG_RPC_PROCESS_SIGACTION
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
-printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
+printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
+process_action_str( action ), pid, cycle );
 #endif
 }  // end rpc_process_sigaction_client() 
@@ -1040,12 +1062,4 @@
 void rpc_process_sigaction_server( xptr_t xp )
 {
-#if DEBUG_RPC_PROCESS_SIGACTION
-uint32_t cycle = (uint32_t)hal_get_cycles();
-thread_t * this = CURRENT_THREAD;
-if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
-printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
-#endif
-
     // get client cluster identifier and pointer on RPC descriptor
     cxy_t        client_cxy = GET_CXY( xp );
@@ -1056,4 +1070,13 @@
     uint32_t action = (uint32_t)hal_remote_l64( XPTR(client_cxy , &desc->args[1]) );
 
+#if DEBUG_RPC_PROCESS_SIGACTION
+uint32_t cycle = (uint32_t)hal_get_cycles();
+thread_t * this = CURRENT_THREAD;
+if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
+printk("\n[%s] thread[%x,%x] on core %d : enter to %s process %x / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
+process_action_str( action ), pid, cycle );
+#endif
+
     // get client thread pointers
     thread_t * client_ptr = hal_remote_lpt( XPTR( client_cxy , &desc->thread ) );
@@ -1063,19 +1086,23 @@
     process_t * process = cluster_get_local_process_from_pid( pid );
 
-    // call relevant kernel function
-    if      ( action == DELETE_ALL_THREADS  ) process_delete_threads ( process , client_xp ); 
-    else if ( action == BLOCK_ALL_THREADS   ) process_block_threads  ( process ); 
-    else if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process );
+    // call relevant kernel function if found / does nothing if not found
+    if( process != NULL )
+    {
+        if ( action == DELETE_ALL_THREADS  ) process_delete_threads ( process , client_xp ); 
+        if ( action == BLOCK_ALL_THREADS   ) process_block_threads  ( process ); 
+        if ( action == UNBLOCK_ALL_THREADS ) process_unblock_threads( process );
+    }
 
 #if DEBUG_RPC_PROCESS_SIGACTION
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_PROCESS_SIGACTION < cycle )
-printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle );
+printk("\n[%s] thread[%x,%x] on core %d : exit after %s process %x / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid,
+process_action_str( action ), pid, cycle );
 #endif
 } // end rpc_process_sigaction_server() 
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [10]     Marshaling functions attached to RPC_VFS_INODE_CREATE  (blocking)
+// [10]     Marshaling functions attached to RPC_VFS_INODE_CREATE 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1099,5 +1126,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1105,5 +1132,5 @@
     rpc.index    = RPC_VFS_INODE_CREATE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1184,5 +1211,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [11]          Marshaling functions attached to RPC_VFS_INODE_DESTROY  (blocking)
+// [11]          Marshaling functions attached to RPC_VFS_INODE_DESTROY 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1199,5 +1226,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1205,5 +1232,5 @@
     rpc.index    = RPC_VFS_INODE_DESTROY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1253,5 +1280,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [12]          Marshaling functions attached to RPC_VFS_DENTRY_CREATE  (blocking)
+// [12]          Marshaling functions attached to RPC_VFS_DENTRY_CREATE 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1271,5 +1298,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1277,5 +1304,5 @@
     rpc.index    = RPC_VFS_DENTRY_CREATE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1344,5 +1371,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [13]          Marshaling functions attached to RPC_VFS_DENTRY_DESTROY  (blocking)
+// [13]          Marshaling functions attached to RPC_VFS_DENTRY_DESTROY 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1359,5 +1386,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1365,5 +1392,5 @@
     rpc.index    = RPC_VFS_DENTRY_DESTROY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1414,5 +1441,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [14]          Marshaling functions attached to RPC_VFS_FILE_CREATE  (blocking)
+// [14]          Marshaling functions attached to RPC_VFS_FILE_CREATE  
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1432,5 +1459,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1438,5 +1465,5 @@
     rpc.index    = RPC_VFS_FILE_CREATE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1501,5 +1528,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [15]          Marshaling functions attached to RPC_VFS_FILE_DESTROY  (blocking)
+// [15]          Marshaling functions attached to RPC_VFS_FILE_DESTROY  
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1516,5 +1543,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1522,5 +1549,5 @@
     rpc.index    = RPC_VFS_FILE_DESTROY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1570,5 +1597,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [16]      Marshaling functions attached to RPC_VFS_FS_GET_DENTRY  (blocking)
+// [16]      Marshaling functions attached to RPC_VFS_FS_GET_DENTRY 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1588,5 +1615,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1594,5 +1621,5 @@
     rpc.index    = RPC_VFS_FS_GET_DENTRY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1661,5 +1688,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [17]      Marshaling function attached to RPC_VFS_FS_ADD_DENTRY  (blocking)
+// [17]      Marshaling function attached to RPC_VFS_FS_ADD_DENTRY  
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1677,5 +1704,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1683,5 +1710,5 @@
     rpc.index    = RPC_VFS_FS_ADD_DENTRY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1703,5 +1730,5 @@
 }
 
-/////////////////////////////////////////////////
+//////////////////////////////////////////////
 void rpc_vfs_fs_add_dentry_server( xptr_t xp )
 {
@@ -1741,5 +1768,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [18]      Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY  (blocking)
+// [18]      Marshaling function attached to RPC_VFS_FS_REMOVE_DENTRY 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1757,5 +1784,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1763,5 +1790,5 @@
     rpc.index    = RPC_VFS_FS_REMOVE_DENTRY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1821,5 +1848,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [19]     Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES  (blocking)
+// [19]     Marshaling functions attached to RPC_VFS_INODE_LOAD_ALL_PAGES 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1837,5 +1864,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1843,5 +1870,5 @@
     rpc.index    = RPC_VFS_INODE_LOAD_ALL_PAGES;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1898,5 +1925,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [20]          Marshaling functions attached to RPC_VMM_GET_VSEG  (blocking)
+// [20]          Marshaling functions attached to RPC_VMM_GET_VSEG 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -1916,5 +1943,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -1922,5 +1949,5 @@
     rpc.index    = RPC_VMM_GET_VSEG;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -1986,5 +2013,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [21]    Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE  (blocking)
+// [21]    Marshaling functions attached to RPC_VMM_GLOBAL_UPDATE_PTE 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2004,5 +2031,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2010,5 +2037,5 @@
     rpc.index    = RPC_VMM_GLOBAL_UPDATE_PTE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2067,5 +2094,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [22]          Marshaling functions attached to RPC_KCM_ALLOC  (blocking)
+// [22]          Marshaling functions attached to RPC_KCM_ALLOC 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2073,5 +2100,5 @@
 void rpc_kcm_alloc_client( cxy_t      cxy,
                            uint32_t   kmem_type,   // in
-                           xptr_t *   buf_xp )     // out
+                           xptr_t   * buf_xp )     // out
 {
 #if DEBUG_RPC_KCM_ALLOC
@@ -2083,5 +2110,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2089,5 +2116,5 @@
     rpc.index    = RPC_KCM_ALLOC;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2145,5 +2172,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [23]          Marshaling functions attached to RPC_KCM_FREE  (blocking)
+// [23]          Marshaling functions attached to RPC_KCM_FREE 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2161,5 +2188,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2167,5 +2194,5 @@
     rpc.index    = RPC_KCM_FREE;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2222,5 +2249,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [25]          Marshaling functions attached to RPC_MAPPER_HANDLE_MISS (blocking)
+// [25]          Marshaling functions attached to RPC_MAPPER_HANDLE_MISS 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2240,5 +2267,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2246,5 +2273,5 @@
     rpc.index    = RPC_MAPPER_HANDLE_MISS;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2309,10 +2336,11 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [26]  Marshaling functions attached to RPC_VMM_DELETE_VSEG (parallel / non blocking)
+// [26]  Marshaling functions attached to RPC_VMM_DELETE_VSEG 
 /////////////////////////////////////////////////////////////////////////////////////////
 
 //////////////////////////////////////////////////
 void rpc_vmm_delete_vseg_client( cxy_t        cxy,
-                                 rpc_desc_t * rpc )
+                                 pid_t        pid,
+                                 intptr_t     vaddr )
 {
 #if DEBUG_RPC_VMM_DELETE_VSEG
@@ -2324,10 +2352,18 @@
 #endif
 
-// check RPC "index" and "blocking" arguments
-assert( (rpc->blocking == false) , "must be non-blocking\n");
-assert( (rpc->index == RPC_VMM_DELETE_VSEG ) , "bad RPC index\n" );
+    uint32_t    responses = 1;
+    rpc_desc_t  rpc;
+
+    // initialise RPC descriptor header 
+    rpc.index    = RPC_VMM_DELETE_VSEG;
+    rpc.blocking = true;
+    rpc.rsp      = &responses;
+
+    // set input arguments in RPC descriptor 
+    rpc.args[0] = (uint64_t)pid;
+    rpc.args[1] = (uint64_t)vaddr;
 
     // register RPC request in remote RPC fifo
-    rpc_send( cxy , rpc );
+    rpc_send( cxy , &rpc );
 
 #if DEBUG_RPC_VMM_DELETE_VSEG
@@ -2370,5 +2406,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [27]          Marshaling functions attached to RPC_VMM_CREATE_VSEG (blocking)
+// [27]          Marshaling functions attached to RPC_VMM_CREATE_VSEG 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2393,5 +2429,5 @@
 #endif
 
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2399,5 +2435,5 @@
     rpc.index    = RPC_VMM_CREATE_VSEG;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2472,5 +2508,5 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-// [28]          Marshaling functions attached to RPC_VMM_SET_COW (blocking)
+// [28]          Marshaling functions attached to RPC_VMM_SET_COW 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2479,5 +2515,13 @@
                              process_t * process )
 {
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+#if DEBUG_RPC_VMM_SET_COW
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_SET_COW )
+printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
+
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2485,5 +2529,5 @@
     rpc.index    = RPC_VMM_SET_COW;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2493,4 +2537,10 @@
     rpc_send( cxy , &rpc );
 
+#if DEBUG_RPC_VMM_SET_COW
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_SET_COW )
+printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
 }
 
@@ -2498,4 +2548,12 @@
 void rpc_vmm_set_cow_server( xptr_t xp )
 {
+#if DEBUG_RPC_VMM_SET_COW
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_SET_COW )
+printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
+
     process_t * process;
 
@@ -2510,8 +2568,14 @@
     vmm_set_cow( process );
 
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// [29]          Marshaling functions attached to RPC_VMM_DISPLAY (blocking)
+#if DEBUG_RPC_VMM_SET_COW
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_SET_COW )
+printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// [29]          Marshaling functions attached to RPC_VMM_DISPLAY 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2521,5 +2585,13 @@
                              bool_t      detailed )
 {
-    assert( (cxy != local_cxy) , "server cluster is not remote\n");
+#if DEBUG_RPC_VMM_DISPLAY
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_DISPLAY )
+printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
+
+    uint32_t responses = 1;
 
     // initialise RPC descriptor header 
@@ -2527,5 +2599,5 @@
     rpc.index    = RPC_VMM_DISPLAY;
     rpc.blocking = true;
-    rpc.responses = 1;
+    rpc.rsp      = &responses;
 
     // set input arguments in RPC descriptor 
@@ -2536,4 +2608,10 @@
     rpc_send( cxy , &rpc );
 
+#if DEBUG_RPC_VMM_DISPLAY
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_DISPLAY )
+printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
 }
 
@@ -2541,4 +2619,12 @@
 void rpc_vmm_display_server( xptr_t xp )
 {
+#if DEBUG_RPC_VMM_DISPLAY
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_DISPLAY )
+printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
+
     process_t * process;
     bool_t      detailed;
@@ -2555,5 +2641,11 @@
     vmm_display( process , detailed );
 
-}
-
-
+#if DEBUG_RPC_VMM_DISPLAY
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_VMM_DISPLAY )
+printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
+#endif
+}
+
+
