Index: trunk/kernel/kern/rpc.c
===================================================================
--- trunk/kernel/kern/rpc.c	(revision 503)
+++ trunk/kernel/kern/rpc.c	(revision 564)
@@ -43,5 +43,6 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////
-//      array of function pointers  (must be consistent with enum in rpc.h) 
+// Array of function pointers and array of printable strings.
+// These arrays must be kept consistent with enum in rpc.h file. 
 /////////////////////////////////////////////////////////////////////////////////////////
 
@@ -82,5 +83,41 @@
 };
 
-//////////////////////////////////////////////
+char * rpc_str[RPC_MAX_INDEX] =
+{
+    "PMEM_GET_PAGES",         // 0
+    "PMEM_RELEASE_PAGES",     // 1
+    "undefined",              // 2
+    "PROCESS_MAKE_FORK",      // 3
+    "undefined",              // 4
+    "undefined",              // 5
+    "THREAD_USER_CREATE",     // 6
+    "THREAD_KERNEL_CREATE",   // 7
+    "undefined",              // 8
+    "PROCESS_SIGACTION",      // 9
+
+    "VFS_INODE_CREATE",       // 10
+    "VFS_INODE_DESTROY",      // 11
+    "VFS_DENTRY_CREATE",      // 12
+    "VFS_DENTRY_DESTROY",     // 13
+    "VFS_FILE_CREATE",        // 14
+    "VFS_FILE_DESTROY",       // 15
+    "VFS_INODE_LOAD",         // 16
+    "VFS_MAPPER_LOAD_ALL",    // 17
+    "FATFS_GET_CLUSTER",      // 18
+    "undefined",              // 19
+
+    "GET_VSEG",               // 20
+    "GET_PTE",                // 21
+    "KCM_ALLOC",              // 22
+    "KCM_FREE",               // 23
+    "MAPPER_MOVE_BUFFER",     // 24
+    "MAPPER_GET_PAGE",        // 25
+    "VMM_CREATE_VSEG",        // 26
+    "undefined",              // 27
+    "VMM_SET_COW",            // 28
+    "VMM_DISPLAY",            // 29
+};
+
+//////////////////////////////////////////////////////////////////////////////////
 void __attribute__((noinline)) rpc_undefined( xptr_t xp __attribute__ ((unused)) )
 {
@@ -105,13 +142,17 @@
     client_core_lid = this->core->lid;
 
+// check calling thread can yield when it is not the idle thread
+assert( (this->busylocks == 0) || (this->type == THREAD_IDLE),
+"cannot yield : busylocks = %d\n", this->busylocks );
+
 #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 );
+printk("\n[DBG] %s : thread %x in process %x enter for rpc %s / server_cxy %x / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], server_cxy, 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 , &LOCAL_CLUSTER->cores_nr ) ) )
+    if( client_core_lid < hal_remote_l32( XPTR( server_cxy , &LOCAL_CLUSTER->cores_nr ) ) )
     {
         server_core_lid = client_core_lid;
@@ -130,10 +171,12 @@
 
     // get local pointer on rpc_fifo in remote cluster,
-    remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[server_core_lid];
-
-	// post RPC in remote fifo / deschedule and retry if fifo full
+    remote_fifo_t * rpc_fifo    = &LOCAL_CLUSTER->rpc_fifo[server_core_lid];
+    xptr_t          rpc_fifo_xp = XPTR( server_cxy , rpc_fifo );
+
+	// post RPC in remote fifo / deschedule without blocking if fifo full
     do
     { 
-        full = remote_fifo_put_item( XPTR( server_cxy , rpc_fifo ), (uint64_t )desc_xp );
+        full = remote_fifo_put_item( rpc_fifo_xp , (uint64_t )desc_xp );
+
 	    if ( full ) 
         {
@@ -151,7 +194,8 @@
 #if DEBUG_RPC_CLIENT_GENERIC
 cycle = (uint32_t)hal_get_cycles();
+uint32_t items = remote_fifo_items( rpc_fifo_xp );
 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 );
+printk("\n[DBG] %s : thread %x in process %x / rpc %s / items %d / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], items, cycle );
 #endif
 	
@@ -159,29 +203,30 @@
    dev_pic_send_ipi( server_cxy , server_core_lid );
 
-    // wait RPC completion before returning if blocking RPC
-    // - busy waiting policy during kernel_init, or if threads cannot yield
-    // - block and deschedule in all other cases
+    // wait RPC completion before returning if blocking RPC :
+    // - descheduling without blocking if thread idle (in lernel init)
+    // - block and deschedule policy for any other thread
     if ( rpc->blocking )
     {
-        if( (this->type == THREAD_IDLE) || (thread_can_yield() == false) ) // busy waiting
+        if( this->type == THREAD_IDLE )  // deschedule without blocking policy
         {
-
+  
 #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 busy waiting for rpc[%d] / cycle %d\n",
-__FUNCTION__, this->trdid, this->process->pid, rpc->index , cycle );
-#endif
-
-            while( rpc->responses ) hal_fixed_delay( 100 );
+printk("\n[DBG] %s : thread %x in process %x enter waiting loop for rpc %s / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], cycle );
+#endif
+
+             while( rpc->responses ) sched_yield( "busy waiting on RPC");
     
 #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 resumes for rpc[%d] / cycle %d\n",
-__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
-#endif
-        } 
-        else                                                         // block & deschedule
+printk("\n[DBG] %s : thread %x in process %x received response for rpc %s / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], cycle );
+#endif
+ 
+        }
+        else                            // block and deschedule policy
         {
 
@@ -189,22 +234,27 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < 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 );
-            sched_yield("blocked on RPC");
+printk("\n[DBG] %s : thread %x in process %x blocks & deschedules for rpc %s / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], cycle );
+#endif
+
+        // block client thread
+        thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_RPC );
+
+        // deschedule
+        sched_yield("blocked on RPC");
 
 #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 resumes for rpc[%d] / cycle %d\n",
-__FUNCTION__, this->trdid, this->process->pid, rpc->index, cycle );
+printk("\n[DBG] %s : thread %x in process %x resumes for rpc %s / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], cycle );
 #endif
         }
 
-        // check response available
-        assert( (rpc->responses == 0) , "illegal RPC response\n" );
+// response must be available for a blocking RPC
+assert( (rpc->responses == 0) , "illegal response for RPC %s\n", rpc_str[rpc->index] );
+
     }
-    else  // non blocking RPC
+    else       // non blocking RPC
     {
 
@@ -212,6 +262,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_CLIENT_GENERIC < 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 );
+printk("\n[DBG] %s : thread %x in process %x returns for non blocking rpc %s / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, rpc_str[rpc->index], cycle );
 #endif
 
@@ -224,102 +274,5 @@
 /***************************************************************************************/
 
-////////////////
-void rpc_check( void )
-{
-    error_t         error;
-    thread_t      * thread;  
-    uint32_t        sr_save;
-
-#if DEBUG_RPC_SERVER_GENERIC
-uint32_t cycle;
-#endif
-
-    bool_t          found    = false;
-	thread_t      * this     = CURRENT_THREAD;
-    core_t        * core     = this->core;
-    scheduler_t   * sched    = &core->scheduler;
-	remote_fifo_t * rpc_fifo = &LOCAL_CLUSTER->rpc_fifo[core->lid];
-
-    // interrupted thread not preemptable during RPC chek
-	hal_disable_irq( &sr_save );
-
-    // activate (or create) RPC thread if RPC FIFO not empty and no acive RPC thread  
-	if( (rpc_fifo->owner == 0) && (local_fifo_is_empty(rpc_fifo) == false) )
-    {
-
-#if DEBUG_RPC_SERVER_GENERIC
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC FIFO non empty for core[%x,%d] / cycle %d\n",
-__FUNCTION__, local_cxy, core->lid, cycle );
-#endif
-
-        // search one IDLE RPC thread associated to the selected core   
-        list_entry_t * iter;
-        LIST_FOREACH( &sched->k_root , iter )
-        {
-            thread = LIST_ELEMENT( iter , thread_t , sched_list );
-            if( (thread->type == THREAD_RPC) && (thread->blocked == THREAD_BLOCKED_IDLE ) ) 
-            {
-                // unblock found RPC thread
-                thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_IDLE );
-
-                // exit loop
-                found = true;
-                break;
-            }
-        }
-
-        // create new RPC thread for the selected core if not found    
-        if( found == false )                    
-        {
-            error = thread_kernel_create( &thread,
-                                          THREAD_RPC, 
-			                              &rpc_thread_func, 
-                                          NULL,
-			                              core->lid );
-	         
-            assert( (error == 0),
-            "no memory to allocate a new RPC thread in cluster %x", local_cxy );
-
-            // unblock created RPC thread
-            thread->blocked = 0;
-
-            // update RRPC threads counter  
-            hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[core->lid] , 1 );
-
-#if DEBUG_RPC_SERVER_GENERIC
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < 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
-        }
-    }
-
-#if DEBUG_RPC_SERVER_GENERIC
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : interrupted thread %x deschedules on core[%x,%d] / cycle %d\n",
-__FUNCTION__, this, local_cxy, core->lid, cycle );
-#endif
-
-    // interrupted thread always deschedule          
-	sched_yield("IPI received");
-
-#if DEBUG_RPC_SERVER_GENERIC
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : interrupted thread %x resumes on core[%x,%d] / cycle %d\n",
-__FUNCTION__, this, local_cxy, core->lid, cycle );
-#endif
-
-    // interrupted thread restore IRQs after resume 
-	hal_restore_irq( sr_save );
-
-} // end rpc_check()
-
-
-//////////////////////
+////////////////////////////
 void rpc_thread_func( void )
 {
@@ -345,12 +298,9 @@
 	rpc_fifo        = &LOCAL_CLUSTER->rpc_fifo[server_core_lid];
 
-    // two embedded loops:
-    // - external loop : "infinite" RPC thread
-    // - internal loop : handle one RPC request per iteration
- 
-	while(1)  // infinite loop
+    // "infinite" RPC thread loop
+	while(1)
 	{
         // try to take RPC_FIFO ownership
-        if( hal_atomic_test_set( &rpc_fifo->owner , server_ptr->trdid ) )
+        if( hal_atomic_test_set( &rpc_fifo->owner , server_ptr->trdid ) ) 
         {
 
@@ -358,76 +308,68 @@
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC thread %x in cluster %x takes RPC fifo ownership / cycle %d\n",
-__FUNCTION__, server_ptr, local_cxy, cycle );
-#endif
-	        while( 1 )  //  one RPC request per iteration 
+printk("\n[DBG] %s : RPC thread %x on core[%d] takes RPC_FIFO ownership / cycle %d\n",
+__FUNCTION__, server_ptr->trdid, server_core_lid, cycle );
+#endif
+	        // try to consume one RPC request  
+  	        empty = remote_fifo_get_item( rpc_fifo , (uint64_t *)&desc_xp );
+
+            // release RPC_FIFO ownership
+            rpc_fifo->owner = 0;
+
+            // handle RPC request if success
+	        if ( empty == 0 )   
             {
-  	            empty = local_fifo_get_item( rpc_fifo , (uint64_t *)&desc_xp );
-
-                // exit when FIFO empty or FIFO ownership lost (in case of descheduling)
-	            if ( (empty == 0) && (rpc_fifo->owner == server_ptr->trdid) )
+                // get client cluster and pointer on RPC descriptor
+                desc_cxy = GET_CXY( desc_xp );
+                desc_ptr = GET_PTR( desc_xp );
+
+	            index    = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->index ) );
+                blocking = hal_remote_l32( XPTR( desc_cxy , &desc_ptr->blocking ) );
+
+#if DEBUG_RPC_SERVER_GENERIC
+cycle = (uint32_t)hal_get_cycles();
+uint32_t items = remote_fifo_items( XPTR( local_cxy , rpc_fifo ) );
+if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
+printk("\n[DBG] %s : RPC thread %x got rpc %s / client_cxy %x / items %d / cycle %d\n",
+__FUNCTION__, server_ptr->trdid, rpc_str[index], desc_cxy, items, cycle );
+#endif
+                // call the relevant server function
+                rpc_server[index]( desc_xp );
+
+#if DEBUG_RPC_SERVER_GENERIC
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
+printk("\n[DBG] %s : RPC thread %x completes rpc %s / client_cxy %x / cycle %d\n",
+__FUNCTION__, server_ptr->trdid, rpc_str[index], desc_cxy, cycle );
+#endif
+                // decrement response counter in RPC descriptor if blocking RPC
+                if( blocking )
                 {
-                    // get client cluster and pointer on RPC descriptor
-                    desc_cxy = GET_CXY( desc_xp );
-                    desc_ptr = GET_PTR( desc_xp );
-
-	                index    = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->index ) );
-                    blocking = hal_remote_lw( XPTR( desc_cxy , &desc_ptr->blocking ) );
+                    // decrement responses counter in RPC descriptor
+                    hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->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 );
+
+                    hal_fence();
 
 #if DEBUG_RPC_SERVER_GENERIC
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC thread %x in cluster %x got rpc[%d] / rpc_cxy %x / rpc_ptr %x\n",
-__FUNCTION__, server_ptr, local_cxy, index, desc_cxy, desc_ptr );
-#endif
-                    // call the relevant server function
-                    rpc_server[index]( desc_xp );
-
-#if DEBUG_RPC_SERVER_GENERIC
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC thread %x in cluster %x completes rpc[%d] / rpc_ptr %x / cycle %d\n",
-__FUNCTION__, server_ptr, local_cxy, index, desc_ptr, cycle );
-#endif
-                    // decrement response counter in RPC descriptor if blocking
-                    if( blocking )
-                    {
-                        // decrement responses counter in RPC descriptor
-                        hal_remote_atomic_add( XPTR( desc_cxy, &desc_ptr->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_lw ( XPTR( desc_cxy , &desc_ptr->lid ) );
-
-                        // unblock client thread
-                        thread_unblock( XPTR( desc_cxy , client_ptr ) , THREAD_BLOCKED_RPC );
-
-                        hal_fence();
-
-#if DEBUG_RPC_SERVER_GENERIC
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC thread %x (cluster %x) unblocked client thread %x (cluster %x)\n",
-__FUNCTION__, server_ptr, local_cxy, client_ptr, desc_cxy, cycle );
-#endif
-                        // send IPI to client core
-	                    // dev_pic_send_ipi( desc_cxy , client_core_lid );
-                    }
-		        }
-                else
-                {
-                    break;
-                }
-         	} // end internal loop
-
-            // release rpc_fifo ownership if not lost
-            if( rpc_fifo->owner == server_ptr->trdid ) rpc_fifo->owner = 0;
-
-        }  // end if RPC fifo
-
-        // RPC thread blocks on IDLE 
-        thread_block( server_xp , THREAD_BLOCKED_IDLE );
-
-        // sucide if too many RPC threads / simply deschedule otherwise
+printk("\n[DBG] %s : RPC thread %x unblocked client thread %x / cycle %d\n",
+__FUNCTION__, server_ptr->trdid, client_ptr->trdid, cycle );
+#endif
+                    // send IPI to client core
+                    dev_pic_send_ipi( desc_cxy , client_core_lid );
+
+                }  // end if blocking RPC
+            }  // end RPC handling if fifo non empty
+        }  // end if RPC_fIFO ownership successfully taken and released
+
+        // sucide if too many RPC threads 
         if( LOCAL_CLUSTER->rpc_threads[server_core_lid] >= CONFIG_RPC_THREADS_MAX )
 	    {
@@ -436,9 +378,9 @@
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC thread %x in cluster %x suicides / cycle %d\n",
-__FUNCTION__, server_ptr, local_cxy, cycle );
+printk("\n[DBG] %s : RPC thread %x suicides / cycle %d\n",
+__FUNCTION__, server_ptr->trdid, cycle );
 #endif
             // update RPC threads counter
-	        hal_atomic_add( &LOCAL_CLUSTER->rpc_threads , -1 );
+	        hal_atomic_add( &LOCAL_CLUSTER->rpc_threads[server_core_lid] , -1 );
 
             // RPC thread blocks on GLOBAL
@@ -448,4 +390,5 @@
             hal_remote_atomic_or( server_xp , THREAD_FLAG_REQ_DELETE );
 	    }
+        // block and deschedule otherwise
         else
         {
@@ -454,15 +397,14 @@
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_RPC_SERVER_GENERIC < cycle ) 
-printk("\n[DBG] %s : RPC thread %x in cluster %x block & deschedules / cycle %d\n",
-__FUNCTION__, server_ptr, local_cxy, cycle );
-#endif
+printk("\n[DBG] %s : RPC thread %x block IDLE & deschedules / cycle %d\n",
+__FUNCTION__, server_ptr->trdid, cycle );
+#endif
+            // RPC thread blocks on IDLE 
+            thread_block( server_xp , THREAD_BLOCKED_IDLE );
 
             // RPC thread deschedules
-            assert( thread_can_yield() , "illegal sched_yield\n" );
-            sched_yield("RPC fifo empty");
+            sched_yield("RPC_FIFO empty");
         }
-
 	} // end infinite loop
-
 } // end rpc_thread_func()
 
@@ -478,8 +420,9 @@
 {
 #if DEBUG_RPC_PMEM_GET_PAGES
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -504,6 +447,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -513,8 +456,9 @@
 {
 #if DEBUG_RPC_PMEM_GET_PAGES
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -524,5 +468,5 @@
 
     // get input arguments from client RPC descriptor
-    uint32_t order = (uint32_t)hal_remote_lwd( XPTR( cxy , &desc->args[0] ) );
+    uint32_t order = (uint32_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) );
     
     // call local pmem allocator
@@ -530,11 +474,11 @@
 
     // set output arguments into client RPC descriptor
-    hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page );
+    hal_remote_s64( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page );
 
 #if DEBUG_RPC_PMEM_GET_PAGES
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_GET_PAGES )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -549,8 +493,9 @@
 {
 #if DEBUG_RPC_PMEM_RELEASE_PAGES
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -572,6 +517,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -581,8 +526,9 @@
 {
 #if DEBUG_RPC_PMEM_RELEASE_PAGES
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -592,5 +538,5 @@
 
     // get input arguments from client RPC descriptor
-    page_t * page = (page_t *)(intptr_t)hal_remote_lwd( XPTR( cxy , &desc->args[0] ) );
+    page_t * page = (page_t *)(intptr_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) );
     
     // release memory to local pmem 
@@ -603,6 +549,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PMEM_RELEASE_PAGES )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -625,8 +571,9 @@
 {
 #if DEBUG_RPC_PROCESS_MAKE_FORK
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -654,6 +601,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -663,8 +610,9 @@
 {
 #if DEBUG_RPC_PROCESS_MAKE_FORK
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -680,6 +628,6 @@
 
     // get input arguments from cient RPC descriptor
-    ref_process_xp   = (xptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    parent_thread_xp = (xptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
+    ref_process_xp   = (xptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    parent_thread_xp = (xptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
 
     // call local kernel function
@@ -690,13 +638,13 @@
 
     // set output argument into client RPC descriptor
-    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)child_pid );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)(intptr_t)child_thread_ptr );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)child_pid );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)(intptr_t)child_thread_ptr );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
 
 #if DEBUG_RPC_PROCESS_MAKE_FORK
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_PROCESS_MAKE_FORK )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -723,4 +671,12 @@
                                     error_t        * error )      // out 
 {
+#if DEBUG_RPC_THREAD_USER_CREATE
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_USER_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
+
     assert( (cxy != local_cxy) , "target cluster is not remote\n");
 
@@ -744,4 +700,10 @@
     *error     = (error_t)rpc.args[5];
 
+#if DEBUG_RPC_THREAD_USER_CREATE
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_USER_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
 }
 
@@ -749,4 +711,11 @@
 void rpc_thread_user_create_server( xptr_t xp )
 {
+#if DEBUG_RPC_THREAD_USER_CREATE
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_USER_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
 
     pthread_attr_t * attr_ptr;   // pointer on attributes structure in client cluster 
@@ -767,8 +736,8 @@
 
     // get input arguments from RPC descriptor
-    pid        = (pid_t)                     hal_remote_lwd(XPTR(client_cxy , &desc->args[0]));
-    start_func = (void *)(intptr_t)          hal_remote_lwd(XPTR(client_cxy , &desc->args[1]));
-    start_arg  = (void *)(intptr_t)          hal_remote_lwd(XPTR(client_cxy , &desc->args[2]));
-    attr_ptr   = (pthread_attr_t *)(intptr_t)hal_remote_lwd(XPTR(client_cxy , &desc->args[3]));
+    pid        = (pid_t)                     hal_remote_l64(XPTR(client_cxy , &desc->args[0]));
+    start_func = (void *)(intptr_t)          hal_remote_l64(XPTR(client_cxy , &desc->args[1]));
+    start_arg  = (void *)(intptr_t)          hal_remote_l64(XPTR(client_cxy , &desc->args[2]));
+    attr_ptr   = (pthread_attr_t *)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[3]));
 
     // makes a local copy of attributes structure
@@ -786,7 +755,13 @@
     // set output arguments
     thread_xp = XPTR( local_cxy , thread_ptr );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)thread_xp );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error );
-
+    hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)thread_xp );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error );
+
+#if DEBUG_RPC_THREAD_USER_CREATE
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_USER_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
 }
 
@@ -803,4 +778,12 @@
                                       error_t * error )      // out
 {
+#if DEBUG_RPC_THREAD_KERNEL_CREATE
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
+
     assert( (cxy != local_cxy) , "target cluster is not remote\n");
 
@@ -823,4 +806,10 @@
     *error     = (error_t)rpc.args[4];
 
+#if DEBUG_RPC_THREAD_KERNEL_CREATE
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
 }
 
@@ -828,4 +817,12 @@
 void rpc_thread_kernel_create_server( xptr_t xp )
 {
+#if DEBUG_RPC_THREAD_KERNEL_CREATE
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
+
     thread_t       * thread_ptr;  // local pointer on thread descriptor
     xptr_t           thread_xp;   // extended pointer on thread descriptor
@@ -838,7 +835,7 @@
 
     // get attributes from RPC descriptor
-    uint32_t  type = (uint32_t)       hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    void    * func = (void*)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
-    void    * args = (void*)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
+    uint32_t  type = (uint32_t)       hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    void    * func = (void*)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
+    void    * args = (void*)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
 
     // select one core
@@ -850,7 +847,13 @@
     // set output arguments
     thread_xp = XPTR( local_cxy , thread_ptr );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp );
-
+    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)thread_xp );
+
+#if DEBUG_RPC_THREAD_KERNEL_CREATE
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_THREAD_KERNEL_CREATE)
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
+#endif
 }
 
@@ -913,6 +916,6 @@
 
     // get arguments from RPC descriptor
-    action   = (uint32_t)hal_remote_lwd( XPTR(client_cxy , &rpc->args[0]) );
-    pid      = (pid_t)   hal_remote_lwd( XPTR(client_cxy , &rpc->args[1]) );
+    action   = (uint32_t)hal_remote_l64( XPTR(client_cxy , &rpc->args[0]) );
+    pid      = (pid_t)   hal_remote_l64( XPTR(client_cxy , &rpc->args[1]) );
 
 #if DEBUG_RPC_PROCESS_SIGACTION
@@ -945,5 +948,5 @@
     {
         // get client core lid
-        client_lid    = (lid_t)     hal_remote_lw ( XPTR( client_cxy , &rpc->lid    ) );
+        client_lid    = (lid_t)     hal_remote_l32 ( XPTR( client_cxy , &rpc->lid    ) );
 
         // unblock client thread
@@ -981,8 +984,9 @@
 {
 #if DEBUG_RPC_VFS_INODE_CREATE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1013,8 +1017,8 @@
 
 #if DEBUG_RPC_VFS_INODE_CREATE
-uint32_t cycle = (uint32_t)hal_get_cycles();
+cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1024,8 +1028,9 @@
 {
 #if DEBUG_RPC_VFS_INODE_CREATE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -1046,12 +1051,12 @@
 
     // get input arguments from client rpc descriptor
-    dentry_xp  = (xptr_t)          hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    fs_type    = (uint32_t)        hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
-    inode_type = (uint32_t)        hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
-    extend     = (void *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[3] ) );
-    attr       = (uint32_t)        hal_remote_lwd( XPTR( client_cxy , &desc->args[4] ) );
-    rights     = (uint32_t)        hal_remote_lwd( XPTR( client_cxy , &desc->args[5] ) );
-    uid        = (uid_t)           hal_remote_lwd( XPTR( client_cxy , &desc->args[6] ) );
-    gid        = (gid_t)           hal_remote_lwd( XPTR( client_cxy , &desc->args[7] ) );
+    dentry_xp  = (xptr_t)          hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    fs_type    = (uint32_t)        hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
+    inode_type = (uint32_t)        hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
+    extend     = (void *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
+    attr       = (uint32_t)        hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
+    rights     = (uint32_t)        hal_remote_l64( XPTR( client_cxy , &desc->args[5] ) );
+    uid        = (uid_t)           hal_remote_l64( XPTR( client_cxy , &desc->args[6] ) );
+    gid        = (gid_t)           hal_remote_l64( XPTR( client_cxy , &desc->args[7] ) );
 
     // call local kernel function
@@ -1067,12 +1072,12 @@
 
     // set output arguments
-    hal_remote_swd( XPTR( client_cxy , &desc->args[8] ) , (uint64_t)inode_xp );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[9] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[8] ) , (uint64_t)inode_xp );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[9] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VFS_INODE_CREATE
-uint32_t cycle = (uint32_t)hal_get_cycles();
+cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_CREATE )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1088,8 +1093,9 @@
 {
 #if DEBUG_RPC_VFS_INODE_DESTROY
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -1112,8 +1118,8 @@
 
 #if DEBUG_RPC_VFS_INODE_DESTROY
-uint32_t cycle = (uint32_t)hal_get_cycles();
+cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1123,8 +1129,9 @@
 {
 #if DEBUG_RPC_VFS_INODE_DESTROY
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -1137,5 +1144,5 @@
 
     // get arguments "inode" from client RPC descriptor
-    inode = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
+    inode = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
                        
     // call local kernel function
@@ -1143,11 +1150,11 @@
 
     // set output argument
-    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VFS_INODE_DESTROY
-uint32_t cycle = (uint32_t)hal_get_cycles();
+cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_INODE_DESTROY )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1166,8 +1173,9 @@
 {
 #if DEBUG_RPC_VFS_DENTRY_CREATE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 
@@ -1195,6 +1203,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1204,8 +1212,9 @@
 {
 #if DEBUG_RPC_VFS_DENTRY_CREATE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1222,7 +1231,7 @@
 
     // get arguments "name", "type", and "parent" from client RPC descriptor
-    type   = (uint32_t)               hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    name   = (char *)(intptr_t)       hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
-    parent = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
+    type   = (uint32_t)               hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    name   = (char *)(intptr_t)       hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
+    parent = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
 
     // makes a local copy of  name
@@ -1236,12 +1245,12 @@
                                &dentry_xp );
     // set output arguments
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)dentry_xp );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)dentry_xp );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VFS_DENTRY_CREATE
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_CREATE )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1257,8 +1266,9 @@
 {
 #if DEBUG_RPC_VFS_DENTRY_DESTROY
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1283,6 +1293,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1292,8 +1302,9 @@
 {
 #if DEBUG_RPC_VFS_DENTRY_DESTROY
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1306,5 +1317,5 @@
 
     // get arguments "dentry" from client RPC descriptor
-    dentry = (vfs_dentry_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
+    dentry = (vfs_dentry_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
                        
     // call local kernel function
@@ -1312,11 +1323,11 @@
 
     // set output argument
-    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VFS_DENTRY_DESTROY
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_DENTRY_DESTROY )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1335,8 +1346,9 @@
 {
 #if DEBUG_RPC_VFS_FILE_CREATE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1363,6 +1375,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1372,8 +1384,9 @@
 {
 #if DEBUG_RPC_VFS_FILE_CREATE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1388,6 +1401,6 @@
 
     // get arguments "file_attr" and "inode" from client RPC descriptor
-    inode     = (vfs_inode_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    file_attr = (uint32_t)               hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
+    inode     = (vfs_inode_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    file_attr = (uint32_t)               hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
                        
     // call local kernel function
@@ -1397,12 +1410,12 @@
  
     // set output arguments
-    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)file_xp );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VFS_FILE_CREATE
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_CREATE )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1417,8 +1430,9 @@
 {
 #if DEBUG_RPC_VFS_FILE_DESTROY
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1440,6 +1454,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1449,8 +1463,9 @@
 {
 #if DEBUG_RPC_VFS_FILE_DESTROY
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1462,5 +1477,5 @@
 
     // get arguments "dentry" from client RPC descriptor
-    file = (vfs_file_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
+    file = (vfs_file_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
                        
     // call local kernel function
@@ -1470,6 +1485,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VFS_FILE_DESTROY )
-printk("\n[DBG] %s : thread %x exit / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid, cycle );
 #endif
 }
@@ -1522,7 +1537,7 @@
 
     // get arguments "parent", "name", and "child_xp"
-    parent     = (vfs_inode_t*)(intptr_t)hal_remote_lwd(XPTR(client_cxy , &desc->args[0]));
-    name       = (char*)(intptr_t)       hal_remote_lwd(XPTR(client_cxy , &desc->args[1]));
-    child_xp   = (xptr_t)                hal_remote_lwd(XPTR(client_cxy , &desc->args[2]));
+    parent     = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0]));
+    name       = (char*)(intptr_t)       hal_remote_l64(XPTR(client_cxy , &desc->args[1]));
+    child_xp   = (xptr_t)                hal_remote_l64(XPTR(client_cxy , &desc->args[2]));
 
     // get name local copy
@@ -1534,5 +1549,5 @@
 
     // set output argument
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
 
 }
@@ -1577,5 +1592,5 @@
 
     // get arguments "parent", "name", and "child_xp"
-    inode = (vfs_inode_t*)(intptr_t)hal_remote_lwd(XPTR(client_cxy , &desc->args[0]));
+    inode = (vfs_inode_t*)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0]));
 
     // call the kernel function
@@ -1583,5 +1598,5 @@
 
     // set output argument
-    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)error );
 
 }
@@ -1636,6 +1651,6 @@
     // get input arguments
     mapper = (mapper_t *)(intptr_t)hal_remote_lpt( XPTR( client_cxy , &desc->args[0] ) );
-    first  = (uint32_t)            hal_remote_lw ( XPTR( client_cxy , &desc->args[1] ) );
-    index  = (uint32_t)            hal_remote_lw ( XPTR( client_cxy , &desc->args[2] ) );
+    first  = (uint32_t)            hal_remote_l32 ( XPTR( client_cxy , &desc->args[1] ) );
+    index  = (uint32_t)            hal_remote_l32 ( XPTR( client_cxy , &desc->args[2] ) );
 
     // call the kernel function
@@ -1643,6 +1658,6 @@
 
     // set output argument
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)cluster );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)cluster );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)error );
 
 }
@@ -1660,8 +1675,9 @@
 {
 #if DEBUG_RPC_VMM_GET_VSEG
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_VSEG )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1688,6 +1704,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_VSEG )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 }
@@ -1697,8 +1713,9 @@
 {
 #if DEBUG_RPC_VMM_GET_VSEG
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_VSEG )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1714,6 +1731,6 @@
 
     // get input argument from client RPC descriptor
-    process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    vaddr   = (intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
+    process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    vaddr   = (intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
     
     // call local kernel function
@@ -1722,12 +1739,12 @@
     // set output arguments to client RPC descriptor
     vseg_xp = XPTR( local_cxy , vseg_ptr );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[2] ) , (uint64_t)vseg_xp );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VMM_GET_VSEG
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_VSEG )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 }
@@ -1748,8 +1765,9 @@
 {
 #if DEBUG_RPC_VMM_GET_PTE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_PTE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1778,6 +1796,6 @@
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_PTE )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 }
@@ -1787,8 +1805,9 @@
 {
 #if DEBUG_RPC_VMM_GET_PTE
+thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_PTE )
-printk("\n[DBG] %s : thread %x enter on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 
@@ -1805,7 +1824,7 @@
 
     // get input argument "process" & "vpn" from client RPC descriptor
-    process = (process_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    vpn     = (vpn_t)                hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
-    cow     = (bool_t)               hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
+    process = (process_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    vpn     = (vpn_t)                hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
+    cow     = (bool_t)               hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
     
     // call local kernel function
@@ -1813,13 +1832,13 @@
 
     // set output argument "attr" & "ppn" to client RPC descriptor
-    hal_remote_swd( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)attr );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)ppn );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)attr );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[4] ) , (uint64_t)ppn );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[5] ) , (uint64_t)error );
 
 #if DEBUG_RPC_VMM_GET_PTE
 cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_RPC_VMM_GET_PTE )
-printk("\n[DBG] %s : thread %x exit on core[%x,%d] / cycle %d\n",
-__FUNCTION__ , CURRENT_THREAD , local_cxy, CURRENT_THREAD->core->lid , cycle );
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
 #endif
 }
@@ -1834,4 +1853,12 @@
                            xptr_t *   buf_xp )     // out
 {
+#if DEBUG_RPC_KCM_ALLOC
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_ALLOC )
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
+
     assert( (cxy != local_cxy) , "target cluster is not remote\n");
 
@@ -1851,4 +1878,10 @@
     *buf_xp = (xptr_t)rpc.args[1];
 
+#if DEBUG_RPC_KCM_ALLOC
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_ALLOC )
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
 }
 
@@ -1856,4 +1889,12 @@
 void rpc_kcm_alloc_server( xptr_t xp )
 {
+#if DEBUG_RPC_KCM_ALLOC
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_ALLOC )
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
+
     // get client cluster identifier and pointer on RPC descriptor
     cxy_t        client_cxy  = GET_CXY( xp );
@@ -1861,5 +1902,5 @@
 
     // get input argument "kmem_type" from client RPC descriptor
-    uint32_t kmem_type = (uint32_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
+    uint32_t kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
 
     // allocates memory for kcm
@@ -1871,6 +1912,12 @@
     // set output argument
     xptr_t buf_xp = XPTR( local_cxy , buf_ptr );
-    hal_remote_swd( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp );
-
+    hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (uint64_t)buf_xp );
+
+#if DEBUG_RPC_KCM_ALLOC
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_ALLOC )
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
 }   
 
@@ -1884,4 +1931,12 @@
                           uint32_t   kmem_type )   // in
 {
+#if DEBUG_RPC_KCM_FREE
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_FREE )
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
+
     assert( (cxy != local_cxy) , "target cluster is not remote\n");
 
@@ -1899,4 +1954,10 @@
     rpc_send( cxy , &rpc );
 
+#if DEBUG_RPC_KCM_FREE
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_FREE )
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
 }
 
@@ -1904,4 +1965,12 @@
 void rpc_kcm_free_server( xptr_t xp )
 {
+#if DEBUG_RPC_KCM_FREE
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_FREE )
+printk("\n[DBG] %s : thread %x in process %x on core %d enter / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
+
     // get client cluster identifier and pointer on RPC descriptor
     cxy_t        client_cxy  = GET_CXY( xp );
@@ -1909,6 +1978,6 @@
 
     // get input arguments "buf" and "kmem_type" from client RPC descriptor
-    void     * buf = (void *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    uint32_t   kmem_type = (uint32_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
+    void     * buf = (void *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    uint32_t   kmem_type = (uint32_t)hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
 
     // releases memory
@@ -1918,4 +1987,10 @@
     kmem_free( &req );
 
+#if DEBUG_RPC_KCM_FREE
+cycle = (uint32_t)hal_get_cycles();
+if( cycle > DEBUG_RPC_KCM_FREE )
+printk("\n[DBG] %s : thread %x in process %x on core %d exit / cycle %d\n",
+__FUNCTION__, this->trdid, this->process->pid, this->core->lid , cycle );
+#endif
 }   
 
@@ -1975,14 +2050,14 @@
 
     // get arguments from client RPC descriptor
-    mapper      = (mapper_t *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[0] ) );
-    to_buffer   =                       hal_remote_lwd( XPTR( client_cxy , &desc->args[1] ) );
-    is_user     =                       hal_remote_lwd( XPTR( client_cxy , &desc->args[2] ) );
-    file_offset =                       hal_remote_lwd( XPTR( client_cxy , &desc->args[3] ) );
-    size        =                       hal_remote_lwd( XPTR( client_cxy , &desc->args[5] ) );
+    mapper      = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[0] ) );
+    to_buffer   =                       hal_remote_l64( XPTR( client_cxy , &desc->args[1] ) );
+    is_user     =                       hal_remote_l64( XPTR( client_cxy , &desc->args[2] ) );
+    file_offset =                       hal_remote_l64( XPTR( client_cxy , &desc->args[3] ) );
+    size        =                       hal_remote_l64( XPTR( client_cxy , &desc->args[5] ) );
 
     // call local kernel function
     if( is_user )
     {
-        user_buffer = (void *)(intptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[4] ) );
+        user_buffer = (void *)(intptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
 
         error = mapper_move_user( mapper,
@@ -1994,5 +2069,5 @@
     else
     {
-        kern_buffer = (xptr_t)hal_remote_lwd( XPTR( client_cxy , &desc->args[4] ) );
+        kern_buffer = (xptr_t)hal_remote_l64( XPTR( client_cxy , &desc->args[4] ) );
 
         error = mapper_move_kernel( mapper,
@@ -2004,5 +2079,5 @@
 
     // set output argument to client RPC descriptor
-    hal_remote_swd( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error );
+    hal_remote_s64( XPTR( client_cxy , &desc->args[6] ) , (uint64_t)error );
 
 }
@@ -2046,6 +2121,6 @@
 
     // get input arguments from client RPC descriptor
-    mapper_t * mapper = (mapper_t *)(intptr_t)hal_remote_lwd( XPTR( cxy , &desc->args[0] ) );
-    uint32_t   index  = (uint32_t)            hal_remote_lwd( XPTR( cxy , &desc->args[1] ) );
+    mapper_t * mapper = (mapper_t *)(intptr_t)hal_remote_l64( XPTR( cxy , &desc->args[0] ) );
+    uint32_t   index  = (uint32_t)            hal_remote_l64( XPTR( cxy , &desc->args[1] ) );
     
     // call local pmem allocator
@@ -2053,5 +2128,5 @@
 
     // set output arguments into client RPC descriptor
-    hal_remote_swd( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page );
+    hal_remote_s64( XPTR( cxy , &desc->args[1] ) , (uint64_t)(intptr_t)page );
 
 }
@@ -2107,12 +2182,12 @@
 
     // get input arguments from client RPC descriptor
-    process_t * process     = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0]));
-    vseg_type_t type        = (vseg_type_t)(uint32_t)hal_remote_lwd( XPTR(cxy , &desc->args[1]));
-    intptr_t    base        = (intptr_t)             hal_remote_lwd( XPTR(cxy , &desc->args[2]));
-    uint32_t    size        = (uint32_t)             hal_remote_lwd( XPTR(cxy , &desc->args[3]));
-    uint32_t    file_offset = (uint32_t)             hal_remote_lwd( XPTR(cxy , &desc->args[4]));
-    uint32_t    file_size   = (uint32_t)             hal_remote_lwd( XPTR(cxy , &desc->args[5]));
-    xptr_t      mapper_xp   = (xptr_t)               hal_remote_lwd( XPTR(cxy , &desc->args[6]));
-    cxy_t       vseg_cxy    = (cxy_t)(uint32_t)      hal_remote_lwd( XPTR(cxy , &desc->args[7]));
+    process_t * process     = (process_t *)(intptr_t)hal_remote_l64( XPTR(cxy , &desc->args[0]));
+    vseg_type_t type        = (vseg_type_t)(uint32_t)hal_remote_l64( XPTR(cxy , &desc->args[1]));
+    intptr_t    base        = (intptr_t)             hal_remote_l64( XPTR(cxy , &desc->args[2]));
+    uint32_t    size        = (uint32_t)             hal_remote_l64( XPTR(cxy , &desc->args[3]));
+    uint32_t    file_offset = (uint32_t)             hal_remote_l64( XPTR(cxy , &desc->args[4]));
+    uint32_t    file_size   = (uint32_t)             hal_remote_l64( XPTR(cxy , &desc->args[5]));
+    xptr_t      mapper_xp   = (xptr_t)               hal_remote_l64( XPTR(cxy , &desc->args[6]));
+    cxy_t       vseg_cxy    = (cxy_t)(uint32_t)      hal_remote_l64( XPTR(cxy , &desc->args[7]));
     
     // call local kernel function
@@ -2127,5 +2202,5 @@
 
     // set output arguments into client RPC descriptor
-    hal_remote_swd( XPTR( cxy , &desc->args[8] ) , (uint64_t)(intptr_t)vseg );
+    hal_remote_s64( XPTR( cxy , &desc->args[8] ) , (uint64_t)(intptr_t)vseg );
 
 }
@@ -2169,5 +2244,5 @@
 
     // get input arguments from client RPC descriptor
-    process = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0]));
+    process = (process_t *)(intptr_t)hal_remote_l64( XPTR(cxy , &desc->args[0]));
     
     // call local kernel function
@@ -2213,6 +2288,6 @@
 
     // get input arguments from client RPC descriptor
-    process  = (process_t *)(intptr_t)hal_remote_lwd( XPTR(cxy , &desc->args[0]));
-    detailed = (bool_t)               hal_remote_lwd( XPTR(cxy , &desc->args[1]));
+    process  = (process_t *)(intptr_t)hal_remote_l64( XPTR(cxy , &desc->args[0]));
+    detailed = (bool_t)               hal_remote_l64( XPTR(cxy , &desc->args[1]));
     
     // call local kernel function
