Index: /soft/giet_vm/giet_libs/barrier.c
===================================================================
--- /soft/giet_vm/giet_libs/barrier.c	(revision 430)
+++ /soft/giet_vm/giet_libs/barrier.c	(revision 431)
@@ -31,4 +31,13 @@
 void barrier_wait( giet_barrier_t* barrier ) 
 {
+
+#if GIET_DEBUG_BARRIER
+unsigned int x;
+unsigned int y;
+unsigned int p;
+giet_proc_xyp( &x, &y, &p );
+giet_shr_printf("[DEBUG BARRIER] proc[%d,%d,%d] enters barrier_wait()\n", x, y, p );
+#endif
+
     // compute expected sense value 
     unsigned int expected;
@@ -75,4 +84,9 @@
 
     asm volatile ("sync" ::: "memory");
+
+#if GIET_DEBUG_BARRIER
+giet_shr_printf("[DEBUG BARRIER] proc[%d,%d,%d] exit barrier_wait()\n", x, y, p );
+#endif
+
 }
 
@@ -162,6 +176,6 @@
     barrier->ntasks = ntasks;
     
-#if GIET_DEBUG_SBT
-giet_shr_printf("\n[DEBUG SBT] SBT nodes allocation / ntasks = %d\n", ntasks ); 
+#if GIET_DEBUG_BARRIER
+giet_shr_printf("\n[DEBUG BARRIER] sbt_nodes allocation / ntasks = %d\n", ntasks ); 
 #endif
 
@@ -188,5 +202,5 @@
                      barrier->node[x][y][l] = remote_malloc( SBT_NODE_SIZE, x, y );
 
-#if GIET_DEBUG_SBT
+#if GIET_DEBUG_BARRIER
 giet_shr_printf("[DEBUG SBT] node[%d][%d][%d] : vaddr = %x\n",
                 x, y, l, (unsigned int)barrier->node[x][y][l] );
@@ -197,5 +211,5 @@
     }
             
-#if GIET_DEBUG_SBT
+#if GIET_DEBUG_BARRIER
 giet_shr_printf("\n[DEBUG SBT] SBT nodes initialisation\n"); 
 #endif
@@ -211,8 +225,8 @@
 {
     // compute cluster coordinates for the calling task
-    unsigned int procid     = giet_procid();
-    unsigned int cluster_xy = procid / NB_PROCS_MAX;
-    unsigned int x          = cluster_xy >> Y_WIDTH;
-    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
+    unsigned int    x;
+    unsigned int    y;
+    unsigned int    lpid;
+    giet_proc_xyp( &x, &y, &lpid );
 
     // recursively decrement count from bottom to root
@@ -247,6 +261,6 @@
         node->child1   = NULL;
 
-#if GIET_DEBUG_SBT
-giet_shr_printf("[DEBUG SBT] initialize node[%d][%d][%d] :"
+#if GIET_DEBUG_BARRIER
+giet_shr_printf("[DEBUG BARRIER] initialize sbt_node[%d][%d][%d] :"
                 " arity = %d / child0 = %x / child1 = %x\n", 
                 x, y, level, 
@@ -288,6 +302,6 @@
         node->child1   = barrier->node[x1][y1][level-1];
 
-#if GIET_DEBUG_SBT
-giet_shr_printf("[DEBUG SBT] initialize node[%d][%d][%d] :"
+#if GIET_DEBUG_BARRIER
+giet_shr_printf("[DEBUG BARRIER] initialize sbt_node[%d][%d][%d] :"
                 " arity = %d / child0 = %x / child1 = %x\n", 
                 x, y, level, 
Index: /soft/giet_vm/giet_libs/malloc.c
===================================================================
--- /soft/giet_vm/giet_libs/malloc.c	(revision 430)
+++ /soft/giet_vm/giet_libs/malloc.c	(revision 431)
@@ -302,8 +302,9 @@
 void * malloc( unsigned int size )
 {
-    unsigned int proc_id    = giet_procid();
-    unsigned int cluster_xy = proc_id / NB_PROCS_MAX;
-    unsigned int x          = cluster_xy >> Y_WIDTH;
-    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
+    // get cluster coordinates
+    unsigned int    x;
+    unsigned int    y;
+    unsigned int    lpid;
+    giet_proc_xyp( &x, &y, &lpid );
 
     return remote_malloc( size, x, y );
Index: /soft/giet_vm/giet_libs/remote_malloc.c
===================================================================
--- /soft/giet_vm/giet_libs/remote_malloc.c	(revision 430)
+++ /soft/giet_vm/giet_libs/remote_malloc.c	(revision 431)
@@ -41,5 +41,5 @@
     if ( align > 31  ) 
     {
-        giet_exit("in remote_malloc(), align constraint > 31\n");
+        giet_exit(" in remote_malloc(), align constraint > 31\n");
     }
 
@@ -47,13 +47,14 @@
     if ( length == 0 ) 
     {
-        giet_exit("in remote_malloc(), requested length = 0\n");
+        giet_exit(" in remote_malloc(), requested length = 0\n");
     }
 
-#if GIET_DEBUG_MALLOC
-unsigned int procid  = giet_procid();
-unsigned int cluster = procid / NB_PROCS_MAX;
+unsigned int gpid    = giet_procid();
+unsigned int cluster = gpid >> P_WIDTH;
 unsigned int proc_x  = cluster >> Y_WIDTH;
 unsigned int proc_y  = cluster & ((1<<Y_WIDTH)-1);
-unsigned int lpid    = procid % NB_PROCS_MAX;
+unsigned int lpid    = gpid & ((1<<P_WIDTH)-1);
+
+#if GIET_DEBUG_MALLOC
 giet_shr_printf("\n[DEBUG MALLOC] Processor[%d,%d,%d] enters remote_malloc()"
                 " : length = %x / align = %x for heap(%d,%d)\n",
@@ -78,7 +79,6 @@
     else
     {
-        unsigned int pid = giet_procid();
-        heap_x = (pid / NB_PROCS_MAX) >> Y_WIDTH;
-        heap_y = (pid / NB_PROCS_MAX) & ((1<<Y_WIDTH)-1);
+        heap_x = proc_x;
+        heap_y = proc_y;
     }
 
Index: /soft/giet_vm/giet_libs/stdio.c
===================================================================
--- /soft/giet_vm/giet_libs/stdio.c	(revision 430)
+++ /soft/giet_vm/giet_libs/stdio.c	(revision 431)
@@ -15,8 +15,13 @@
 
 /////////////////
-int giet_procid() 
-{
-    return sys_call( SYSCALL_PROCID,
-                     0, 0, 0, 0 );
+void giet_proc_xyp( unsigned int* cluster_x,
+                    unsigned int* cluster_y,
+                    unsigned int* lpid )
+{
+    sys_call( SYSCALL_PROCID,
+              (unsigned int)cluster_x,
+              (unsigned int)cluster_y,
+              (unsigned int)lpid,
+               0 );
 }
 
Index: /soft/giet_vm/giet_libs/stdio.h
===================================================================
--- /soft/giet_vm/giet_libs/stdio.h	(revision 430)
+++ /soft/giet_vm/giet_libs/stdio.h	(revision 431)
@@ -116,7 +116,10 @@
 
 //////////////////////////////////////////////////////////////////////////
-// This function returns the processor identifier.
-//////////////////////////////////////////////////////////////////////////
-extern int giet_procid();
+// This function returns the processor (x,y,lpid) identifier: 
+// (x,y) are the cluster coordinates / lpid is the local processor index.
+//////////////////////////////////////////////////////////////////////////
+extern void giet_proc_xyp( unsigned int* cluster_x,
+                           unsigned int* cluster_y,
+                           unsigned int* lpid );
 
 //////////////////////////////////////////////////////////////////////////
