Index: soft/giet_vm/giet_common/utils.c
===================================================================
--- soft/giet_vm/giet_common/utils.c	(revision 351)
+++ soft/giet_vm/giet_common/utils.c	(revision 370)
@@ -375,4 +375,71 @@
                   :
                   : "r" (value), "r" (lsb), "r" (msb)
+                  : "$2", "$3" );
+
+    _it_restore(&sr);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// This function makes a physical read access to a 64 bits word in memory, 
+// after a temporary DTLB de-activation and paddr extension.
+////////////////////////////////////////////////////////////////////////////
+inline unsigned long long _physical_read_ull( unsigned long long paddr ) 
+{
+    unsigned int data_lsb;
+    unsigned int data_msb;
+    unsigned int addr_lsb = (unsigned int) paddr;
+    unsigned int addr_msb = (unsigned int) (paddr >> 32);
+    unsigned int sr;
+
+    _it_disable(&sr);
+
+    asm volatile( "mfc2   $2,     $1                 \n"     /* $2 <= MMU_MODE       */
+                  "andi   $3,     $2,        0xb     \n"
+                  "mtc2   $3,     $1                 \n"     /* DTLB off             */    
+
+                  "mtc2   %3,     $24                \n"     /* PADDR_EXT <= msb     */   
+                  "lw     %0,     0(%2)              \n"     /* data_lsb <= *paddr   */
+                  "lw     %1,     4(%2)              \n"     /* data_msb <= *paddr+4 */
+                  "mtc2   $0,     $24                \n"     /* PADDR_EXT <= 0       */   
+
+                  "mtc2   $2,     $1                 \n"     /* restore MMU_MODE     */
+                  : "=r" (data_lsb), "=r"(data_msb)
+                  : "r" (addr_lsb), "r" (addr_msb)
+                  : "$2", "$3" );
+
+    _it_restore(&sr);
+
+    return ( (((unsigned long long)data_msb)<<32) +
+             (((unsigned long long)data_lsb)) );
+}
+
+////////////////////////////////////////////////////////////////////////////
+// This function makes a physical write access to a 64 bits word in memory, 
+// after a temporary DTLB de-activation and paddr extension.
+////////////////////////////////////////////////////////////////////////////
+inline void _physical_write_ull( unsigned long long paddr, 
+                                 unsigned long long value ) 
+{
+    unsigned int addr_lsb = (unsigned int)paddr;
+    unsigned int addr_msb = (unsigned int)(paddr >> 32);
+    unsigned int data_lsb = (unsigned int)value;
+    unsigned int data_msb = (unsigned int)(value >> 32);
+    unsigned int sr;
+
+    _it_disable(&sr);
+
+    asm volatile( "mfc2   $2,     $1                 \n"     /* $2 <= MMU_MODE     */
+                  "andi   $3,     $2,        0xb     \n"
+                  "mtc2   $3,     $1                 \n"     /* DTLB off           */    
+
+                  "mtc2   %3,     $24                \n"     /* PADDR_EXT <= msb   */   
+                  "sw     %0,     0(%2)              \n"     /* *paddr <= value    */
+                  "sw     %1,     4(%2)              \n"     /* *paddr+4 <= value  */
+                  "mtc2   $0,     $24                \n"     /* PADDR_EXT <= 0     */   
+
+                  "mtc2   $2,     $1                 \n"     /* restore MMU_MODE   */
+                  "sync                              \n"
+                  :
+                  : "r" (data_lsb), "r" (data_msb), "r" (addr_lsb), "r" (addr_msb)
                   : "$2", "$3" );
 
@@ -933,30 +1000,65 @@
 
 ///////////////////////////////////////////////////////////////////////////////////
-// This function returns the information associated to a heap : size and vaddr.
+// This function returns the information associated to a heap : vaddr and length.
+// - If (x < X_SIZE) and (y < Y_SIZE), it return the heap associated to any task
+// running in cluster(x,y). 
+// - Else, it return the heap associated to the calling task.
 // It uses the global task index (CTX_GTID_ID, unique for each giet task) and the
-// vspace index (CTX_VSID_ID) defined in the task context. 
+// vspace index (CTX_VSID_ID), that are defined in the calling task context
+// to find the vobj_id containing the heap. 
+// Return 0 if success. Return non zero if not found.
 ///////////////////////////////////////////////////////////////////////////////////
 unsigned int _heap_info( unsigned int* vaddr, 
-                         unsigned int* size ) 
+                         unsigned int* length,
+                         unsigned int  x,
+                         unsigned int  y ) 
 {
     mapping_header_t * header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
-    mapping_task_t * tasks     = _get_task_base(header);
-    mapping_vobj_t * vobjs     = _get_vobj_base(header);
-
-    unsigned int taskid        = _get_context_slot(CTX_GTID_ID);
-
-    int vobj_id = tasks[taskid].heap_vobj_id;
-    if (vobj_id != -1) 
-    {
-        *vaddr                  = vobjs[vobj_id].vaddr;
-        *size                   = vobjs[vobj_id].length;
+    mapping_task_t *   tasks   = _get_task_base(header);
+    mapping_vobj_t *   vobjs   = _get_vobj_base(header);
+    mapping_vspace_t * vspaces = _get_vspace_base(header);
+
+    unsigned int task_id;
+    unsigned int vspace_id;
+    unsigned int vobj_id = 0xFFFFFFFF;
+
+    // searching the heap vobj_id
+    if ( (x < X_SIZE) && (y < Y_SIZE) )  // searching a task in cluster(x,y)
+    {
+        // get vspace global index
+        vspace_id = _get_context_slot(CTX_VSID_ID);
+
+        // scan all tasks in vspace
+        unsigned int min = vspaces[vspace_id].task_offset ;
+        unsigned int max = min + vspaces[vspace_id].tasks ;
+        for ( task_id = min ; task_id < max ; task_id++ )
+        {
+            if ( tasks[task_id].clusterid == (x * Y_SIZE + y) )
+            {
+                vobj_id = tasks[task_id].heap_vobj_id;
+                if ( vobj_id != 0xFFFFFFFF ) break;
+            }
+        }
+    }
+    else                                // searching in the calling task 
+    {
+        task_id = _get_context_slot(CTX_GTID_ID);
+        vobj_id = tasks[task_id].heap_vobj_id;
+    }
+
+    // analysing the vobj_id
+    if ( vobj_id != 0xFFFFFFFF ) 
+    {
+        *vaddr  = vobjs[vobj_id].vaddr;
+        *length = vobjs[vobj_id].length;
+        return 0;
     }
     else 
     {
         *vaddr = 0;
-        *size = 0;
-    }
-    return 0;
-}
+        *length = 0;
+        return 1;
+    }
+}  // end _heap_info()
 
 /////////////////////////////////////////////////////////////////////////////
