Index: soft/giet_vm/giet_drivers/xcu_driver.c
===================================================================
--- soft/giet_vm/giet_drivers/xcu_driver.c	(revision 333)
+++ 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
