Index: /soft/giet_vm/Makefile
===================================================================
--- /soft/giet_vm/Makefile	(revision 344)
+++ /soft/giet_vm/Makefile	(revision 345)
@@ -118,5 +118,5 @@
                build/libs/barrier.o
 
-CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32
+CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -O2
 
 GIET_INCLUDE = -Igiet_boot    \
@@ -497,3 +497,5 @@
 	rm -rf build/transpose/*
 	rm -rf build/convol/*
+
+distclean: clean
 	rm -rf hdd/virt_hdd.dmg
Index: /soft/giet_vm/convol/main.c
===================================================================
--- /soft/giet_vm/convol/main.c	(revision 344)
+++ /soft/giet_vm/convol/main.c	(revision 345)
@@ -259,4 +259,5 @@
     if ( INITIAL_DISPLAY_ENABLE )
     {
+        date = giet_proctime();
         giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] starts initial display at cycle %d\n",
                          x, y, lpid, date);
@@ -279,4 +280,5 @@
         }
 
+        date = giet_proctime();
         giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] completes initial display at cycle %d\n",
                          x, y, lpid, date);
Index: /soft/giet_vm/giet_boot/boot.c
===================================================================
--- /soft/giet_vm/giet_boot/boot.c	(revision 344)
+++ /soft/giet_vm/giet_boot/boot.c	(revision 345)
@@ -2013,7 +2013,7 @@
             else
             {
-                _memcpy( (char*)seg_vaddr,
-                         (char*)src_vaddr,
-                         seg_filesz );
+                memcpy( (char*)seg_vaddr,
+                        (char*)src_vaddr,
+                        seg_filesz );
             }
         }
Index: /soft/giet_vm/giet_common/io.h
===================================================================
--- /soft/giet_vm/giet_common/io.h	(revision 344)
+++ /soft/giet_vm/giet_common/io.h	(revision 345)
@@ -40,5 +40,5 @@
 {
 	*(volatile unsigned int *) addr = value;
-	asm volatile("sync");
+	asm volatile("sync" ::: "memory");
 }
 
@@ -49,5 +49,5 @@
 {
 	*(volatile unsigned short *) addr = value;
-	asm volatile("sync");
+	asm volatile("sync" ::: "memory");
 }
 
@@ -58,5 +58,5 @@
 {
 	*(volatile unsigned char *) addr = value;
-	asm volatile("sync");
+	asm volatile("sync" ::: "memory");
 }
 
Index: /soft/giet_vm/giet_common/utils.c
===================================================================
--- /soft/giet_vm/giet_common/utils.c	(revision 344)
+++ /soft/giet_vm/giet_common/utils.c	(revision 345)
@@ -44,7 +44,7 @@
 // Code taken from MutekH.
 ///////////////////////////////////////////////////////////////////////////////////
-inline void* _memcpy( void*        dest,     // dest buffer vbase
-                      const void*  source,   // source buffer vbase
-                      unsigned int size )    // bytes
+inline void* memcpy( void*        dest,     // dest buffer vbase
+                     const void*  source,   // source buffer vbase
+                     unsigned int size )    // bytes
 {
     unsigned int* idst = (unsigned int*)dest;
@@ -74,7 +74,7 @@
 // Fill a byte string with a byte value.
 //////////////////////////////////////////////////////////////////////////////////
-inline void * _memset( void*        dest, 
-                       int          value, 
-                       unsigned int count ) 
+inline void * memset( void*        dest, 
+                      int          value, 
+                      unsigned int count ) 
 {
     // word-by-word copy
@@ -119,4 +119,5 @@
 // Processor suicide: infinite loop  
 //////////////////////////////////////////////////////////////////////////////////
+__attribute__((noreturn))
 inline void _exit() 
 {
@@ -251,12 +252,12 @@
 inline void _it_disable( unsigned int * save_sr_ptr) 
 {
-    unsigned int sr;
+    unsigned int sr = 0;
     asm volatile( "li      $3,        0xFFFFFFFE    \n"
                   "mfc0    %0,        $12           \n"
                   "and     $3,        $3,   %0      \n"  
                   "mtc0    $3,        $12           \n" 
-                  : "=r"(sr)
+                  : "+r"(sr)
                   :
-                  : "$3", "memory" );
+                  : "$3" );
     *save_sr_ptr = sr;
 }
@@ -292,5 +293,6 @@
     asm volatile ( "mtc2     %0,     $0            \n"
                    :
-                   :"r" (val) );
+                   :"r" (val)
+                   :"memory" );
 }
 //////////////////////////////////////////////////////////////////////////////
@@ -301,5 +303,6 @@
     asm volatile ( "mtc2     %0,     $1             \n"
                    :
-                   :"r" (val) );
+                   :"r" (val)
+                   :"memory" );
 }
 //////////////////////////////////////////////////////////////////////////////
@@ -369,4 +372,5 @@
 
                   "mtc2   $2,     $1                 \n"     /* restore MMU_MODE */
+                  "sync                              \n"
                   :
                   : "r" (value), "r" (lsb), "r" (msb)
@@ -516,5 +520,5 @@
             :
             :"r"(plock), "r"(delay)
-            :"$2", "$3", "$4");
+            :"$2", "$3", "$4", "memory");
 #else
 
@@ -532,5 +536,5 @@
             :
             :"r"(plock)
-            :"$2", "$3");
+            :"$2", "$3", "memory");
 #endif
 
Index: /soft/giet_vm/giet_common/utils.h
===================================================================
--- /soft/giet_vm/giet_common/utils.h	(revision 344)
+++ /soft/giet_vm/giet_common/utils.h	(revision 345)
@@ -62,11 +62,11 @@
 ///////////////////////////////////////////////////////////////////////////////////
 
-extern void* _memcpy( void* _dst, 
-                      const void* _src, 
-                      unsigned int size );
-
-extern void* _memset( void* dst, 
-                      int s, 
-                      unsigned int count );
+extern void* memcpy( void* _dst, 
+                     const void* _src, 
+                     unsigned int size );
+
+extern void* memset( void* dst, 
+                     int s, 
+                     unsigned int count );
 
 ///////////////////////////////////////////////////////////////////////////////////
Index: /soft/giet_vm/giet_common/vmem.c
===================================================================
--- /soft/giet_vm/giet_common/vmem.c	(revision 344)
+++ /soft/giet_vm/giet_common/vmem.c	(revision 345)
@@ -95,11 +95,13 @@
     unsigned long long pte2_paddr;
 
-    register unsigned int pte2_msb;
-    register unsigned int pte2_lsb;
-    register unsigned int flags_value;
-    register unsigned int ppn_value;
+    volatile unsigned int pte2_msb;
+    volatile unsigned int pte2_lsb;
+    unsigned int flags_value;
+    unsigned int ppn_value;
 
     unsigned int ix1 = vpn >> 9;
     unsigned int ix2 = vpn & 0x1FF;
+
+    unsigned int save_sr;
 
     // get PTE1
@@ -110,18 +112,17 @@
 
     // get physical addresses of pte2 (two 32 bits words)
-    ptba       = (unsigned long long) (pt->pt1[ix1] & 0x0FFFFFFF) << 12;
+    ptba       = (unsigned long long) (pte1 & 0x0FFFFFFF) << 12;
     pte2_paddr = ptba + 8*ix2;
     pte2_lsb   = (unsigned int) pte2_paddr;
     pte2_msb   = (unsigned int) (pte2_paddr >> 32);
 
+    // disable interrupts and save status register
+    _it_disable( &save_sr );
+
     // gets ppn_value and flags_value, after temporary DTLB desactivation
     asm volatile (
-                "li      $2,     0xFFFFFFFE  \n"     /* Mask for IE bits     */
-                "mfc0    $4,     $12         \n"     /* $4 <= SR             */ 
-                "and     $2,     $2,    $4   \n"
-                "mtc0    $2,     $12         \n"     /* disable Interrupts   */
-
-                "li      $3,     0xB         \n"     
-                "mtc2    $3,     $1          \n"     /* DTLB unactivated     */ 
+                "mfc2    $2,     $1          \n"     /* $2 <= MMU_MODE       */
+                "andi    $3,     $2,    0xb  \n"
+                "mtc2    $3,     $1          \n"     /* DTLB off             */
 
                 "mtc2    %2,     $24         \n"     /* PADDR_EXT <= msb     */
@@ -130,11 +131,11 @@
                 "mtc2    $0,     $24         \n"     /* PADDR_EXT <= 0       */
 
-                "li      $3,     0xF         \n" 
-                "mtc2    $3,     $1          \n"     /* DTLB activated       */
+                "mtc2    $2,     $1          \n"     /* restore MMU_MODE     */
+                : "=r" (flags_value), "=r" (ppn_value)
+                : "r"  (pte2_msb)   , "r"  (pte2_lsb)
+                : "$2", "$3");
 
-                "mtc0    $4,     $12         \n"     /* restore SR           */
-                : "=r" (flags_value), "=r" (ppn_value)
-                : "r" (pte2_msb), "r" (pte2_lsb)
-                : "$2","$3","$4");
+    // restore saved status register
+    _it_restore( &save_sr );
 
     // check PTE2 mapping
@@ -142,6 +143,7 @@
 
     // set return values 
-    *ppn = ppn_value;
+    *ppn   = ppn_value;
     *flags = flags_value;
+
     return 0;
 } // end _v2p_translate()
Index: /soft/giet_vm/giet_drivers/dma_driver.c
===================================================================
--- /soft/giet_vm/giet_drivers/dma_driver.c	(revision 344)
+++ /soft/giet_vm/giet_drivers/dma_driver.c	(revision 345)
@@ -32,4 +32,5 @@
 #include <vmem.h>
 #include <utils.h>
+#include <io.h>
 
 #if !defined(X_SIZE) 
@@ -61,5 +62,42 @@
 #endif
 
-extern unsigned int _ptabs_vaddr[];
+extern volatile unsigned int _ptabs_vaddr[];
+
+///////////////////////////////////////////////////////////////////////////////
+// This low level function returns the value contained in register "index"
+// in the DMA component contained in cluster "cluster_xy"
+///////////////////////////////////////////////////////////////////////////////
+static
+unsigned int _dma_get_register( unsigned int cluster_xy, // cluster index
+                                unsigned int channel_id, // channel index
+                                unsigned int index )     // register index
+{
+    unsigned int vaddr =
+        SEG_DMA_BASE + 
+        (cluster_xy * PERI_CLUSTER_INCREMENT) +
+        (channel_id * DMA_SPAN) +
+        (index << 2);
+
+    return ioread32( (void*)vaddr );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// This low level function sets a new value in register "index"
+// in the DMA component contained in cluster "cluster_xy"
+///////////////////////////////////////////////////////////////////////////////
+static
+void _dma_set_register( unsigned int cluster_xy,       // cluster index
+                        unsigned int channel_id,       // channel index
+                        unsigned int index,            // register index
+                        unsigned int value )           // value to be written
+{
+    unsigned int vaddr =
+        SEG_DMA_BASE + 
+        (cluster_xy * PERI_CLUSTER_INCREMENT) +
+        (channel_id * DMA_SPAN) +
+        (index << 2);
+
+    iowrite32( (void*)vaddr, value );
+}
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -81,10 +119,6 @@
     if (channel_id >= NB_DMA_CHANNELS)  return 1; 
 
-    // compute DMA base address
-    unsigned int* dma_address = (unsigned int*) ( SEG_DMA_BASE + 
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // disable interrupt for selected channel
-    dma_address[channel_id * DMA_SPAN + DMA_IRQ_DISABLE] = 1;            
+    _dma_set_register(cluster_xy, channel_id, DMA_IRQ_DISABLE, 1);
     return 0;
 #else
@@ -109,10 +143,6 @@
     if (channel_id >= NB_DMA_CHANNELS)  return 1; 
 
-    // compute DMA base address
-    unsigned int* dma_address = (unsigned int*) ( SEG_DMA_BASE + 
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // reset selected channel
-    dma_address[channel_id * DMA_SPAN + DMA_RESET] = 0;            
+    _dma_set_register(cluster_xy, channel_id, DMA_RESET, 0);
     return 0;
 #else
@@ -136,10 +166,6 @@
     if (channel_id >= NB_DMA_CHANNELS)  return 1;
 
-    // compute DMA base address
-    unsigned int * dma_address = (unsigned int *) ( SEG_DMA_BASE + 
-                                 (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // get selected channel status
-    return dma_address[channel_id * DMA_SPAN + DMA_LEN];
+    return _dma_get_register(cluster_xy, channel_id, DMA_LEN);
 #else
     return DMA_IDLE;
@@ -160,14 +186,15 @@
 #if NB_DMA_CHANNELS > 0
 
-    // compute DMA base address
-    unsigned int * dma_address = (unsigned int *) ( SEG_DMA_BASE + 
-                                 (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // selected channel configuration and lauching
-    dma_address[channel_id * DMA_SPAN + DMA_SRC]     = (unsigned int)(src_paddr);
-    dma_address[channel_id * DMA_SPAN + DMA_SRC_EXT] = (unsigned int)(src_paddr>>32);
-    dma_address[channel_id * DMA_SPAN + DMA_DST]     = (unsigned int)(dst_paddr);
-    dma_address[channel_id * DMA_SPAN + DMA_DST_EXT] = (unsigned int)(dst_paddr>>32);
-    dma_address[channel_id * DMA_SPAN + DMA_LEN]     = (unsigned int)size;
+    _dma_set_register(cluster_xy, channel_id, DMA_SRC,
+            (unsigned int)(src_paddr));
+    _dma_set_register(cluster_xy, channel_id, DMA_SRC_EXT,
+            (unsigned int)(src_paddr>>32));
+    _dma_set_register(cluster_xy, channel_id, DMA_DST,
+            (unsigned int)(dst_paddr));
+    _dma_set_register(cluster_xy, channel_id, DMA_DST_EXT,
+            (unsigned int)(dst_paddr>>32));
+    _dma_set_register(cluster_xy, channel_id, DMA_LEN,
+            (unsigned int)size);
 
 #endif
@@ -312,5 +339,5 @@
 
     // get vspace page table pointer 
-    unsigned int pt =  _ptabs_vaddr[vspace_id];
+    unsigned int pt = _ptabs_vaddr[vspace_id];
 
     // get src_paddr buffer physical addresse
Index: /soft/giet_vm/giet_drivers/fbf_driver.c
===================================================================
--- /soft/giet_vm/giet_drivers/fbf_driver.c	(revision 344)
+++ /soft/giet_vm/giet_drivers/fbf_driver.c	(revision 345)
@@ -64,5 +64,5 @@
     char* fbf_address = (char *)SEG_FBF_BASE + offset;
 
-    _memcpy( fbf_address, buffer, length);
+    memcpy( fbf_address, buffer, length);
 
     return 0;
@@ -81,5 +81,5 @@
     char* fbf_address = (char *)SEG_FBF_BASE + offset;
 
-    _memcpy( buffer, fbf_address, length);
+    memcpy( buffer, fbf_address, length);
 
     return 0;
Index: /soft/giet_vm/giet_drivers/mmc_driver.c
===================================================================
--- /soft/giet_vm/giet_drivers/mmc_driver.c	(revision 344)
+++ /soft/giet_vm/giet_drivers/mmc_driver.c	(revision 345)
@@ -21,4 +21,5 @@
 #include <tty_driver.h>
 #include <utils.h>
+#include <io.h>
 
 #if !defined(X_SIZE) 
@@ -46,4 +47,39 @@
 #endif
 
+///////////////////////////////////////////////////////////////////////////////
+// This low level function returns the value contained in register "index"
+// in the MMC component contained in cluster "cluster_xy"
+///////////////////////////////////////////////////////////////////////////////
+static
+unsigned int _mmc_get_register( unsigned int cluster_xy, // cluster index
+                                unsigned int func,       // function index
+                                unsigned int index )     // register index
+{
+    unsigned int vaddr =
+        SEG_MMC_BASE + 
+        (cluster_xy * PERI_CLUSTER_INCREMENT) +
+        (MMC_REG(func, index) << 2);
+
+    return ioread32( (void*)vaddr );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// This low level function sets a new value in register "index"
+// in the MMC component contained in cluster "cluster_xy"
+///////////////////////////////////////////////////////////////////////////////
+static
+void _mmc_set_register( unsigned int cluster_xy,       // cluster index
+                        unsigned int func,             // func index
+                        unsigned int index,            // register index
+                        unsigned int value )           // value to be written
+{
+    unsigned int vaddr =
+        SEG_MMC_BASE + 
+        (cluster_xy * PERI_CLUSTER_INCREMENT) +
+        (MMC_REG(func, index) << 2);
+        
+    iowrite32( (void*)vaddr, value );
+}
+
 ///////////////////////////////////////////////////////////////////////////////////
 // This function invalidates all cache lines covering a memory buffer defined
@@ -67,18 +103,15 @@
     }
 
-    unsigned int* mmc_address = (unsigned int*)( SEG_MMC_BASE + 
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // get the hard lock protecting exclusive access to MEMC
-    while ( mmc_address[MEMC_LOCK] ) { asm volatile("nop"); }
+    while ( _mmc_get_register(cluster_xy, 0, MEMC_LOCK) );
 
     // write inval arguments
-    mmc_address[MEMC_ADDR_LO]    = (unsigned int)buf_paddr;
-    mmc_address[MEMC_ADDR_HI]    = (unsigned int)(buf_paddr>>32);
-    mmc_address[MEMC_BUF_LENGTH] = buf_length;
-    mmc_address[MEMC_CMD_TYPE]   = MEMC_CMD_INVAL;
+    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_LO   , (unsigned int)buf_paddr);
+    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_HI   , (unsigned int)(buf_paddr>>32));
+    _mmc_set_register(cluster_xy, 0, MEMC_BUF_LENGTH, buf_length);
+    _mmc_set_register(cluster_xy, 0, MEMC_CMD_TYPE  , MEMC_CMD_INVAL);
 
     // release the lock 
-    mmc_address[MEMC_LOCK] = 0;
+    _mmc_set_register(cluster_xy, 0, MEMC_LOCK, 0);
 }
 ///////////////////////////////////////////////////////////////////////////////////
@@ -103,18 +136,15 @@
     }
 
-    unsigned int* mmc_address = (unsigned int*)( SEG_MMC_BASE + 
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // get the hard lock protecting exclusive access to MEMC
-    while ( mmc_address[MEMC_LOCK] ) { asm volatile("nop"); }
+    while ( _mmc_get_register(cluster_xy, 0, MEMC_LOCK) );
 
     // write inval arguments
-    mmc_address[MEMC_ADDR_LO]    = (unsigned int)buf_paddr;
-    mmc_address[MEMC_ADDR_HI]    = (unsigned int)(buf_paddr>>32);
-    mmc_address[MEMC_BUF_LENGTH] = buf_length;
-    mmc_address[MEMC_CMD_TYPE]   = MEMC_CMD_SYNC;
+    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_LO   , (unsigned int)buf_paddr);
+    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_HI   , (unsigned int)(buf_paddr>>32));
+    _mmc_set_register(cluster_xy, 0, MEMC_BUF_LENGTH, buf_length);
+    _mmc_set_register(cluster_xy, 0, MEMC_CMD_TYPE  , MEMC_CMD_SYNC);
 
-    // release the lock protecting MEMC
-    mmc_address[MEMC_LOCK] = 0;
+    // release the lock 
+    _mmc_set_register(cluster_xy, 0, MEMC_LOCK, 0);
 }
 
Index: /soft/giet_vm/giet_drivers/mmc_driver.h
===================================================================
--- /soft/giet_vm/giet_drivers/mmc_driver.h	(revision 344)
+++ /soft/giet_vm/giet_drivers/mmc_driver.h	(revision 345)
@@ -29,4 +29,6 @@
 };
 
+#define MMC_REG(func,idx) ((func<<7)|idx) 
+
 ///////////////////////////////////////////////////////////////////////////////////
 // MEMC access functions (for TSAR architecture)
Index: /soft/giet_vm/giet_drivers/sim_driver.c
===================================================================
--- /soft/giet_vm/giet_drivers/sim_driver.c	(revision 344)
+++ /soft/giet_vm/giet_drivers/sim_driver.c	(revision 345)
@@ -33,5 +33,5 @@
                                  unsigned int * retval) 
 {
-    unsigned int* sim_helper_address = (unsigned int*)&seg_sim_base;
+    volatile unsigned int* sim_helper_address = (unsigned int*)&seg_sim_base;
     
     if (register_index == SIMHELPER_SC_STOP         ||
Index: /soft/giet_vm/giet_drivers/tty_driver.c
===================================================================
--- /soft/giet_vm/giet_drivers/tty_driver.c	(revision 344)
+++ /soft/giet_vm/giet_drivers/tty_driver.c	(revision 345)
@@ -53,8 +53,8 @@
 
 in_unckdata volatile unsigned int _tty_rx_full[NB_TTY_CHANNELS] 
-                                     = { [0 ... NB_TTY_CHANNELS - 1] = 0 };
-
-in_kdata unsigned int _tty_lock[NB_TTY_CHANNELS] 
-                        = { [0 ... NB_TTY_CHANNELS - 1] = 0 };
+    = { [0 ... NB_TTY_CHANNELS - 1] = 0 };
+
+in_unckdata unsigned int _tty_lock[NB_TTY_CHANNELS]
+    = { [0 ... NB_TTY_CHANNELS - 1] = 0 };
 
 //////////////////////////////////////////////////////////////////////////////
Index: /soft/giet_vm/giet_drivers/xcu_driver.c
===================================================================
--- /soft/giet_vm/giet_drivers/xcu_driver.c	(revision 344)
+++ /soft/giet_vm/giet_drivers/xcu_driver.c	(revision 345)
@@ -16,4 +16,5 @@
 #include <mapping_info.h>
 #include <utils.h>
+#include <io.h>
 
 #if !defined(X_SIZE) 
@@ -49,4 +50,38 @@
 #endif
 
+///////////////////////////////////////////////////////////////////////////////
+// This low level function returns the value contained in register "index"
+// in the XCU component contained in cluster "cluster_xy"
+///////////////////////////////////////////////////////////////////////////////
+static
+unsigned int _xcu_get_register( unsigned int cluster_xy, // cluster index
+                                unsigned int func,       // function index
+                                unsigned int index )     // register index
+{
+    unsigned int vaddr =
+        SEG_XCU_BASE + 
+        (cluster_xy * PERI_CLUSTER_INCREMENT) +
+        (XCU_REG(func, index) << 2);
+
+    return ioread32( (void*)vaddr );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// This low level function sets a new value in register "index"
+// in the XCU component contained in cluster "cluster_xy"
+///////////////////////////////////////////////////////////////////////////////
+static
+void _xcu_set_register( unsigned int cluster_xy,       // cluster index
+                        unsigned int func,             // func index
+                        unsigned int index,            // register index
+                        unsigned int value )           // value to be written
+{
+    unsigned int vaddr =
+        SEG_XCU_BASE + 
+        (cluster_xy * PERI_CLUSTER_INCREMENT) +
+        (XCU_REG(func, index) << 2);
+        
+    iowrite32( (void*)vaddr, value );
+}
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -68,8 +103,5 @@
     if (channel >= (NB_PROCS_MAX * IRQ_PER_PROCESSOR)) _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    unsigned int func;
+    unsigned int func = 0;
     if      (irq_type == IRQ_TYPE_PTI) func = XCU_MSK_PTI_ENABLE;
     else if (irq_type == IRQ_TYPE_WTI) func = XCU_MSK_WTI_ENABLE;
@@ -81,5 +113,5 @@
     }
 
-    xcu_address[XCU_REG(func,channel)] = value;
+    _xcu_set_register(cluster_xy, func, channel, value);
 
 #else
@@ -110,8 +142,5 @@
     if (channel >= (NB_PROCS_MAX * IRQ_PER_PROCESSOR)) _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    unsigned int prio = xcu_address[XCU_REG(XCU_PRIO,channel)];
+    unsigned int prio = _xcu_get_register(cluster_xy, XCU_PRIO, channel);
     unsigned int pti_ok = (prio & 0x00000001);
     unsigned int hwi_ok = (prio & 0x00000002);
@@ -162,8 +191,5 @@
     if (wti_index >= 32)           _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    xcu_address[XCU_REG(XCU_WTI_REG,wti_index)] = wdata;
+    _xcu_set_register(cluster_xy, XCU_WTI_REG, wti_index, wdata);
 
 #else
@@ -191,8 +217,5 @@
     if (wti_index >= 32)           _exit(); 
  
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    *value = xcu_address[XCU_REG(XCU_WTI_REG, wti_index)]; 
+    *value = _xcu_get_register(cluster_xy, XCU_WTI_REG, wti_index);
 
 #else
@@ -215,6 +238,5 @@
     if (wti_index >= 32)           _exit(); 
  
-    unsigned int xcu_address = (unsigned int)SEG_XCU_BASE;
-    *address = xcu_address + (XCU_REG(XCU_WTI_REG, wti_index)<<2); 
+    *address = SEG_XCU_BASE + (XCU_REG(XCU_WTI_REG, wti_index)<<2); 
 
 #else
@@ -239,8 +261,5 @@
     if (y >= Y_SIZE)             _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    xcu_address[XCU_REG(XCU_PTI_PER, pti_index)] = period;
+    _xcu_set_register(cluster_xy, XCU_PTI_PER, pti_index, period);
 
 #else
@@ -264,8 +283,5 @@
     if (y >= Y_SIZE)             _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    xcu_address[XCU_REG(XCU_PTI_PER, pti_index)] = 0;
+    _xcu_set_register(cluster_xy, XCU_PTI_PER, pti_index, 0);
 
 #else
@@ -291,9 +307,6 @@
     if (y >= Y_SIZE)             _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
     // This return value is not used / avoid a compilation warning.
-    return xcu_address[XCU_REG(XCU_PTI_ACK, pti_index)];
+    return _xcu_get_register(cluster_xy, XCU_PTI_ACK, pti_index);
 
 #else
@@ -322,13 +335,10 @@
     if (y >= Y_SIZE)             _exit(); 
 
-    unsigned int* xcu_address = (unsigned int *) ( SEG_XCU_BASE +
-                                (cluster_xy * PERI_CLUSTER_INCREMENT) );
-
-    unsigned int period = xcu_address[XCU_REG(XCU_PTI_PER, pti_index)];
+    unsigned int per = _xcu_get_register(cluster_xy, XCU_PTI_PER, pti_index);
 
     // we write 0 first because if the timer is currently running, 
     // the corresponding timer counter is not reset
-    xcu_address[XCU_REG(XCU_PTI_PER, pti_index)] = 0;
-    xcu_address[XCU_REG(XCU_PTI_PER, pti_index)] = period;
+    _xcu_set_register(cluster_xy, XCU_PTI_PER, pti_index, 0);
+    _xcu_set_register(cluster_xy, XCU_PTI_PER, pti_index, per);
 
 #else
Index: /soft/giet_vm/giet_fat32/fat32.c
===================================================================
--- /soft/giet_vm/giet_fat32/fat32.c	(revision 344)
+++ /soft/giet_vm/giet_fat32/fat32.c	(revision 345)
@@ -533,5 +533,5 @@
                     (ord  != NO_MORE_ENTRY ) )         // SFN entry : checked
             {
-                _memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
+                memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
             }
             else if (ord == NO_MORE_ENTRY )            // end of directory : return
@@ -552,5 +552,5 @@
                     (ord != NO_MORE_ENTRY) )           // LFN entry : checked
             {
-                _memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
+                memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
             }
             else if ( (attr != ATTR_LONG_NAME_MASK) && 
@@ -910,5 +910,5 @@
                           (ord  != NO_MORE_ENTRY ) )         // SFN entry : checked
                 {
-                    _memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
+                    memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
                     offset = offset + DIR_ENTRY_SIZE;
                 }
@@ -929,5 +929,5 @@
                     (ord != NO_MORE_ENTRY) )                 // LFN entry : checked
                 {
-                    _memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
+                    memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
                     offset = offset + DIR_ENTRY_SIZE;
                 }
@@ -980,5 +980,5 @@
         else    // file found
         {
-            _memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
+            memcpy( dir_entry, fat.fat_cache + offset, DIR_ENTRY_SIZE );    
             offset     = offset + DIR_ENTRY_SIZE;
             *file_size = read_entry( DIR_FILE_SIZE, dir_entry, 1 );
Index: /soft/giet_vm/giet_kernel/kernel_init.c
===================================================================
--- /soft/giet_vm/giet_kernel/kernel_init.c	(revision 344)
+++ /soft/giet_vm/giet_kernel/kernel_init.c	(revision 345)
@@ -116,8 +116,8 @@
 
 __attribute__((section (".kdata"))) 
-unsigned int _ptabs_vaddr[GIET_NB_VSPACE_MAX];    // virtual addresses
+volatile unsigned int _ptabs_vaddr[GIET_NB_VSPACE_MAX];    // virtual addresses
 
 __attribute__((section (".kdata")))        
-unsigned int _ptabs_ptprs[GIET_NB_VSPACE_MAX];    // physical addresses >> 13
+volatile unsigned int _ptabs_ptprs[GIET_NB_VSPACE_MAX];    // physical addresses >> 13
 
 ///////////////////////////////////////////////////////////////////////////////////
@@ -126,5 +126,5 @@
 
 __attribute__((section (".kdata"))) 
-static_scheduler_t* _schedulers[NB_PROCS_MAX<<(X_WIDTH+Y_WIDTH)]; // virtual addresses
+volatile static_scheduler_t* _schedulers[NB_PROCS_MAX<<(X_WIDTH+Y_WIDTH)]; // virtual addresses
 
 ////////////////////////////////////////////////////////////////////////////////////
@@ -133,5 +133,5 @@
 
 __attribute__((section (".kdata"))) 
-unsigned int _idle_stack[X_SIZE * Y_SIZE * NB_PROCS_MAX * 128 ]; 
+volatile unsigned int _idle_stack[X_SIZE * Y_SIZE * NB_PROCS_MAX * 128 ]; 
 
 ////////////////////////////////////////////////////////////////////////////////////
@@ -140,5 +140,5 @@
 
 __attribute__((section (".kdata"))) 
-unsigned int _init_barrier = 0;
+volatile unsigned int _init_barrier = 0;
 
 ///////////////////////////////////////////////////////////////////////////////////
@@ -340,5 +340,5 @@
 
     // busy waiting until all processors synchronized
-    while ( _init_barrier != NB_TOTAL_PROCS ) asm volatile ("nop");
+    while ( _init_barrier != NB_TOTAL_PROCS );
 
     // set registers and jump to user code
@@ -351,5 +351,5 @@
                    : 
                    : "r"(sp_value), "r"(sr_value), "r"(ptpr_value), "r"(epc_value)
-                   : "$29" );
+                   : "$29", "memory" );
 
 } // end kernel_init()
Index: /soft/giet_vm/giet_libs/barrier.c
===================================================================
--- /soft/giet_vm/giet_libs/barrier.c	(revision 344)
+++ /soft/giet_vm/giet_libs/barrier.c	(revision 345)
@@ -20,6 +20,7 @@
                    unsigned int    value ) 
 {
-    barrier->init  = value;
-    barrier->count = value;
+    barrier->init  = (volatile unsigned int)value;
+    barrier->count = (volatile unsigned int)value;
+    asm volatile ("sync" ::: "memory");
 }
 
@@ -31,19 +32,20 @@
 void barrier_wait( giet_barrier_t* barrier ) 
 {
-    unsigned int * pcount  = (unsigned int *) &barrier->count;
-    unsigned int maxcount = barrier->init;
-    unsigned int count;
+    volatile unsigned int * pcount = (unsigned int *) &barrier->count;
+    volatile unsigned int maxcount = barrier->init;
+    volatile unsigned int count;
 
     // parallel decrement barrier counter using atomic instructions LL/SC
     // - input : pointer on the barrier counter
     // - output : counter value
-    asm volatile ("_barrier_decrement:    \n"
-            "ll   %0, 0(%1)               \n"
-            "addi $3, %0,     -1          \n"
-            "sc   $3, 0(%1)               \n"
-            "beqz $3, _barrier_decrement  \n"
-            : "=&r"(count)
+    asm volatile (
+            "_barrier_decrement:                \n"
+            "ll     %0,   0(%1)                 \n"
+            "addi   $3,   %0,     -1            \n"
+            "sc     $3,   0(%1)                 \n"
+            "beqz   $3,   _barrier_decrement    \n"
+            : "+r"(count)
             : "r"(pcount)
-            : "$2", "$3");
+            : "$3", "memory");
 
     // the last task re-initializes the barrier counter to the max value,
@@ -57,6 +59,8 @@
     else {
         // other tasks busy-wait
-        while (*pcount != maxcount) asm volatile ("nop");
+        while (*pcount != maxcount);
     }
+
+    asm volatile ("sync" ::: "memory");
 }
 
Index: /soft/giet_vm/giet_libs/mwmr_channel.c
===================================================================
--- /soft/giet_vm/giet_libs/mwmr_channel.c	(revision 344)
+++ /soft/giet_vm/giet_libs/mwmr_channel.c	(revision 345)
@@ -43,18 +43,18 @@
     register unsigned int delay = 100;
     asm volatile (
-            "mwmr_lock_try:                    \n"
+            "1:                               \n"
             "ll   $2,    0(%0)                \n" /* $2 <= lock current value */
-            "bnez $2,    mwmr_lock_delay    \n" /* retry after delay if lock busy */
+            "bnez $2,    2f                   \n" /* retry after delay if lock busy */
             "li   $3,    1                    \n" /* $3 <= argument for sc */
             "sc   $3,    0(%0)                \n" /* try to get lock */
-            "bnez $3,    mwmr_lock_ok        \n" /* exit if atomic */
-            "mwmr_lock_delay:                \n"
-            "move $4,    %1                 \n" /* $4 <= delay */
-            "mwmr_lock_loop:                \n"
-            "beqz $4,    mwmr_lock_loop        \n" /* test end delay */
-            "addi $4,    $4,  -1            \n" /* $4 <= $4 - 1 */
-            "j           mwmr_lock_try        \n" /* retry ll */
-            "nop                            \n"
-            "mwmr_lock_ok:                    \n"
+            "bnez $3,    3f                   \n" /* exit if atomic */
+            "2:                               \n"
+            "move $4,    %1                   \n" /* $4 <= delay */
+            "4:                               \n"
+            "beqz $4,    4b                   \n" /* test end delay */
+            "addi $4,    $4,  -1              \n" /* $4 <= $4 - 1 */
+            "j           1b                   \n" /* retry ll */
+            "nop                              \n"
+            "3:                               \n"
             :
             :"r"(plock), "r"(delay)
Index: /soft/giet_vm/giet_libs/stdio.c
===================================================================
--- /soft/giet_vm/giet_libs/stdio.c	(revision 344)
+++ /soft/giet_vm/giet_libs/stdio.c	(revision 345)
@@ -23,11 +23,7 @@
 
 ////////////////////////////////////////
-void giet_tty_printf( char* format, ...) 
-{
-    va_list args;
-    va_start( args, format );
-
-    int          ret;                    // return value from the syscalls 
-    unsigned int channel = 0xFFFFFFFF;   // channel defined in task context
+static int __printf( char* format, unsigned int channel, va_list* args) 
+{
+    int ret;                    // return value from the syscalls 
 
 printf_text:
@@ -56,6 +52,5 @@
     }
 
-    va_end( args );
-    return;
+    return 0;
 
 printf_arguments:
@@ -72,5 +67,5 @@
             case ('c'):             /* char conversion */
             {
-                int val = va_arg( args, int );
+                int val = va_arg( *args, int );
                 len = 1;
                 buf[0] = val;
@@ -80,5 +75,5 @@
             case ('d'):             /* 32 bits decimal signed integer */
             {
-                int val = va_arg( args, int );
+                int val = va_arg( *args, int );
                 if (val < 0) 
                 {
@@ -102,5 +97,5 @@
             case ('u'):             /* 32 bits decimal unsigned integer */
             {
-                unsigned int val = va_arg( args, unsigned int );
+                unsigned int val = va_arg( *args, unsigned int );
                 for(i = 0; i < 10; i++) 
                 {
@@ -114,5 +109,5 @@
             case ('x'):             /* 32 bits hexadecimal integer */
             {
-                unsigned int val = va_arg( args, unsigned int );
+                unsigned int val = va_arg( *args, unsigned int );
                 ret = sys_call(SYSCALL_TTY_WRITE,
                                (unsigned int)"0x",
@@ -132,5 +127,5 @@
             case ('l'):            /* 64 bits hexadecimal unsigned */
             {
-                unsigned long long val = va_arg( args, unsigned long long );
+                unsigned long long val = va_arg( *args, unsigned long long );
                 ret = sys_call(SYSCALL_TTY_WRITE,
                                (unsigned int)"0x",
@@ -150,5 +145,5 @@
             case ('s'):             /* string */
             {
-                char* str = va_arg( args, char* );
+                char* str = va_arg( *args, char* );
                 while (str[len]) 
                 {
@@ -173,7 +168,21 @@
 
 return_error:
-
+    return 1;
+} // end __printf()
+
+
+////////////////////////////////////////
+void giet_tty_printf( char* format, ...) 
+{
+    va_list args;
+
+    va_start( args, format );
+    int ret = __printf(format, 0xFFFFFFFF, &args);
     va_end( args );
-    giet_exit("error in giet_tty_printf()");
+
+    if (ret)
+    {
+        giet_exit("error in giet_tty_printf()");
+    }
 } // end giet_tty_printf()
 
@@ -182,9 +191,6 @@
 {
     va_list args;
-    va_start( args, format );
-
-    int          ret;     // return value from the syscalls 
-    unsigned int channel = 0;
-    unsigned int sr_save;
+    const int channel = 0;
+    volatile unsigned int sr_save;
 
     sys_call( SYSCALL_TTY_GET_LOCK,
@@ -193,28 +199,7 @@
               0, 0 );
 
-printf_text:
-
-    while (*format) 
-    {
-        unsigned int i;
-        for (i = 0 ; format[i] && (format[i] != '%') ; i++);
-        if (i) 
-        {
-            ret = sys_call(SYSCALL_TTY_WRITE, 
-                           (unsigned int)format,
-                           i, 
-                           channel,
-                           0);
-
-            if (ret != i) goto return_error;
-
-            format += i;
-        }
-        if (*format == '%') 
-        {
-            format++;
-            goto printf_arguments;
-        }
-    }
+    va_start( args, format );
+    int ret = __printf(format, channel, &args);
+    va_end( args );
 
     sys_call( SYSCALL_TTY_RELEASE_LOCK,
@@ -222,132 +207,10 @@
               (unsigned int)&sr_save,
               0, 0 );
- 
-    va_end( args );
-    return;
-
-printf_arguments:
-
-    {
-        char buf[20];
-        char * pbuf;
-        unsigned int len = 0;
-        static const char HexaTab[] = "0123456789ABCDEF";
-        unsigned int i;
-
-        switch (*format++) 
-        {
-            case ('c'):             /* char conversion */
-            {
-                int val = va_arg( args, int );
-                len = 1;
-                buf[0] = val;
-                pbuf = &buf[0];
-                break;
-            }
-            case ('d'):             /* 32 bits decimal signed integer */
-            {
-                int val = va_arg( args, int );
-                if (val < 0) 
-                {
-                    val = -val;
-                    ret = sys_call(SYSCALL_TTY_WRITE, 
-                                   (unsigned int)"-",
-                                   1,
-                                   channel,
-                                   0);
-                    if (ret != 1) goto return_error;
-                }
-                for(i = 0; i < 10; i++) 
-                {
-                    buf[9 - i] = HexaTab[val % 10];
-                    if (!(val /= 10)) break;
-                }
-                len =  i + 1;
-                pbuf = &buf[9 - i];
-                break;
-            }
-            case ('u'):             /* 32 bits decimal unsigned integer */
-            {
-                unsigned int val = va_arg( args, unsigned int );
-                for(i = 0; i < 10; i++) 
-                {
-                    buf[9 - i] = HexaTab[val % 10];
-                    if (!(val /= 10)) break;
-                }
-                len =  i + 1;
-                pbuf = &buf[9 - i];
-                break;
-            }
-            case ('x'):             /* 32 bits hexadecimal integer */
-            {
-                unsigned int val = va_arg( args, unsigned int );
-                ret = sys_call(SYSCALL_TTY_WRITE,
-                               (unsigned int)"0x",
-                               2,
-                               channel,
-                               0);
-                if (ret != 2) goto return_error;       
-                for(i = 0; i < 8; i++) 
-                {
-                    buf[7 - i] = HexaTab[val % 16];
-                    if (!(val /= 16))  break;
-                }
-                len =  i + 1;
-                pbuf = &buf[7 - i];
-                break;
-            }
-            case ('l'):            /* 64 bits hexadecimal unsigned */
-            {
-                unsigned long long val = va_arg( args, unsigned long long );
-                ret = sys_call(SYSCALL_TTY_WRITE,
-                               (unsigned int)"0x",
-                               2,
-                               channel,
-                               0);
-                if (ret != 2) goto return_error;
-                for(i = 0; i < 16; i++) 
-                {
-                    buf[15 - i] = HexaTab[val % 16];
-                    if (!(val /= 16))  break;
-                }
-                len =  i + 1;
-                pbuf = &buf[15 - i];
-                break;
-            }
-            case ('s'):             /* string */
-            {
-                char* str = va_arg( args, char* );
-                while (str[len]) 
-                {
-                    len++;
-                }
-                pbuf = str;
-                break;
-            }
-            default:
-                goto return_error;
-        }
-
-        ret = sys_call(SYSCALL_TTY_WRITE, 
-                       (unsigned int)pbuf,
-                       len,
-                       channel, 
-                       0);
-        if (ret != len)  goto return_error;
-        
-        goto printf_text;
-    }
-
-return_error:
-
-    sys_call( SYSCALL_TTY_RELEASE_LOCK,
-              channel,
-              (unsigned int)&sr_save,
-              0, 0 );
-
-    va_end( args );
-    giet_exit("error in giet_shr_printf()");
-}  // end giet_shr_printf()
-
+
+    if (ret)
+    {
+        giet_exit("error in giet_shr_printf()");
+    }
+} // end giet_shr_printf()
 
 /////////////////////////////////
Index: /soft/giet_vm/giet_libs/stdio.h
===================================================================
--- /soft/giet_vm/giet_libs/stdio.h	(revision 344)
+++ /soft/giet_vm/giet_libs/stdio.h	(revision 345)
@@ -72,10 +72,11 @@
     asm volatile(
             "syscall"
-            : "=r" (reg_no_and_output)  /* output argument */
-            : "r" (reg_a0),             /* input arguments */
-            "r" (reg_a1),
-            "r" (reg_a2),
-            "r" (reg_a3),
-            "r" (reg_no_and_output)
+            : "+r" (reg_no_and_output), /* input/output argument */
+              "+r" (reg_a0),             
+              "+r" (reg_a1),
+              "+r" (reg_a2),
+              "+r" (reg_a3),
+              "+r" (reg_no_and_output)
+            : /* input arguments */
             : "memory",
             /* These persistant registers will be saved on the stack by the
@@ -95,5 +96,5 @@
             "t9"
                );
-    return reg_no_and_output;
+    return (volatile int)reg_no_and_output;
 }
 
Index: /soft/giet_vm/router/main.c
===================================================================
--- /soft/giet_vm/router/main.c	(revision 344)
+++ /soft/giet_vm/router/main.c	(revision 345)
@@ -3,4 +3,10 @@
 #include "mapping_info.h"
 #include "hard_config.h"
+
+#if NB_TTY_CHANNELS == 1
+#  define printf(...) giet_shr_printf(__VA_ARGS__)
+#else
+#  define printf(...) giet_tty_printf(__VA_ARGS__)
+#endif
 
 #define NMAX 50
@@ -20,6 +26,6 @@
     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
 
-    giet_tty_printf( "*** Starting task producer on processor[%d,%d,%d] at cycle %d\n\n", 
-                      x, y, lpid, giet_proctime() );
+    printf( "*** Starting task producer on processor[%d,%d,%d] at cycle %d\n\n", 
+             x, y, lpid, giet_proctime() );
 
     giet_vobj_get_vbase( "router" , 
@@ -32,5 +38,5 @@
         buf = n;
         mwmr_write( mwmr, &buf , 1 );
-        giet_tty_printf( "transmitted value : %d\n", buf);
+        printf( "transmitted value : %d\n", buf);
     }
 
@@ -52,6 +58,6 @@
     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
 
-    giet_tty_printf( "*** Starting task consumer on processor[%d,%d,%d] at cycle %d\n\n", 
-                      x, y, lpid, giet_proctime() );
+    printf( "*** Starting task consumer on processor[%d,%d,%d] at cycle %d\n\n", 
+             x, y, lpid, giet_proctime() );
 
     giet_vobj_get_vbase( "router" , 
@@ -63,5 +69,5 @@
     { 
         mwmr_read( mwmr, &buf , 1 );
-        giet_tty_printf( "received token %d / value = %d\n", n  , buf);
+        printf( "received token %d / value = %d\n", n  , buf);
     }
 
@@ -85,6 +91,6 @@
     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
 
-    giet_tty_printf( "*** Starting task router on processor[%d,%d,%d] at cycle %d\n\n", 
-                      x, y, lpid, giet_proctime() );
+    printf( "*** Starting task router on processor[%d,%d,%d] at cycle %d\n\n", 
+             x, y, lpid, giet_proctime() );
 
     giet_vobj_get_vbase( "router" , 
@@ -101,5 +107,5 @@
         tempo = giet_rand() >> 6;
         for ( n = 0 ; n < tempo ; n++ ) asm volatile ("");
-        giet_tty_printf( "token value : %d / temporisation = %d\n", buf, tempo);
+        printf( "token value : %d / temporisation = %d\n", buf, tempo);
         mwmr_write( mwmr_out, &buf , 1 );
     }
Index: /soft/giet_vm/sort/main.c
===================================================================
--- /soft/giet_vm/sort/main.c	(revision 344)
+++ /soft/giet_vm/sort/main.c	(revision 345)
@@ -58,5 +58,5 @@
 int array1[ARRAY_LENGTH];
 
-int init_ok = 0;
+volatile int init_ok = 0;
 
 void bubbleSort(
@@ -95,6 +95,6 @@
                          (unsigned int*)&nb_thread );
     
-    task0_printf("\n[ Thread 0 ] Starting sort application with %d threads "
-                 "at cycle %d\n", *nb_thread, time_start);
+    task0_printf("\n[ Thread 0 ] Starting sort application with %u threads "
+                 "at cycle %u\n", *nb_thread, time_start);
 
     ///////////////////////////
@@ -134,5 +134,4 @@
     for (i = 0; i < __builtin_ctz(*nb_thread); i++)
     {
-        asm volatile ("sync");
         barrier_wait(&barrier[i]);
 
@@ -171,41 +170,43 @@
     //////////////////////////////
     // Verify the resulting array
-
-    if(thread_id == 0)
-    {
-        success = 1;
-
-        for(i=0; i<(ARRAY_LENGTH-1); i++)
-        {
-            if(dst_array[i] > dst_array[i+1])
-            {
-
-                success = 0;
-                failure_index = i;
-                break;
-            }
-        }
-
-        time_end = giet_proctime();
-
-        printf("[ Thread 0 ] Finishing sort application at cycle %d\n"
-               "[ Thread 0 ] Time elapsed = %d\n",
-                time_end, (time_end - time_start) );
-
-        if (success)
-        {
-            exit("!!! Success !!!");
-        }
-        else
-        {
-            printf("[ Thread 0 ] Failure!! Incorrect element: %d\n\r", 
-                   failure_index);
-            for(i=0; i<ARRAY_LENGTH; i++)
-            {
-                printf("array[%d] = %d\n", i, dst_array[i]);
-            }
-            exit("!!!  Failure !!!");
-        }
-    }
+    
+    if(thread_id != 0)
+    {
+        exit("error: only thread 0 should get here");
+    }
+
+    success = 1;
+    for(i=0; i<(ARRAY_LENGTH-1); i++)
+    {
+        if(dst_array[i] > dst_array[i+1])
+        {
+
+            success = 0;
+            failure_index = i;
+            break;
+        }
+    }
+
+    time_end = giet_proctime();
+
+    printf("[ Thread 0 ] Finishing sort application at cycle %d\n"
+           "[ Thread 0 ] Time elapsed = %d\n",
+            time_end, (time_end - time_start) );
+
+    if (success)
+    {
+        exit("!!! Success !!!");
+    }
+    else
+    {
+        printf("[ Thread 0 ] Failure!! Incorrect element: %d\n\r", 
+               failure_index);
+        for(i=0; i<ARRAY_LENGTH; i++)
+        {
+            printf("array[%d] = %d\n", i, dst_array[i]);
+        }
+        exit("!!!  Failure !!!");
+    }
+
     exit("Completed");
 }
Index: /soft/giet_vm/transpose/main.c
===================================================================
--- /soft/giet_vm/transpose/main.c	(revision 344)
+++ /soft/giet_vm/transpose/main.c	(revision 345)
@@ -25,5 +25,5 @@
 #define FILE_PATHNAME       "misc/images.raw"   // file pathname on disk
 
-#define INSTRUMENTATION_OK  0                   // display statistics on TTY when non zero
+#define INSTRUMENTATION_OK  1                   // display statistics on TTY when non zero
 
 ///////////////////////////////////////////////////////
