Index: trunk/kernel/mm/mapper.c
===================================================================
--- trunk/kernel/mm/mapper.c	(revision 625)
+++ trunk/kernel/mm/mapper.c	(revision 626)
@@ -280,5 +280,5 @@
     printk("\n[%s] thread[%x,%x] enter for page %d in <%s> / cycle %d",
     __FUNCTION__, this->process->pid, this->trdid, page_id, name, cycle );
-   if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), name );
+    if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), name );
 }
 if( (DEBUG_MAPPER_HANDLE_MISS < cycle) && (inode == NULL) )
@@ -286,5 +286,5 @@
     printk("\n[%s] thread[%x,%x] enter for page %d in FAT / cycle %d",
     __FUNCTION__, this->process->pid, this->trdid, page_id, cycle );
-   if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), "FAT" );
+    if( DEBUG_MAPPER_HANDLE_MISS & 1 ) grdxt_display( XPTR(local_cxy,&mapper->rt), "FAT" );
 }
 #endif
@@ -324,5 +324,5 @@
     }
 
-    // launch I/O operation to load page from device to mapper
+    // launch I/O operation to load page from IOC device to mapper
     error = vfs_fs_move_page( XPTR( local_cxy , page ) , IOC_SYNC_READ );
 
@@ -401,10 +401,21 @@
 
 #if DEBUG_MAPPER_MOVE_USER
-uint32_t   cycle = (uint32_t)hal_get_cycles();
-thread_t * this  = CURRENT_THREAD;
+uint32_t      cycle      = (uint32_t)hal_get_cycles();
+thread_t    * this       = CURRENT_THREAD;
+cxy_t         mapper_cxy = GET_CXY( mapper_xp );
+mapper_t    * mapper_ptr = GET_PTR( mapper_xp );
+vfs_inode_t * inode_ptr  = hal_remote_lpt( XPTR( mapper_cxy , &mapper_ptr->inode ) );
+xptr_t        inode_xp   = XPTR( mapper_cxy , inode_ptr );
+char          name[CONFIG_VFS_MAX_NAME_LENGTH];
+vfs_inode_get_name( inode_xp , name );
 if( DEBUG_MAPPER_MOVE_USER < cycle )
-printk("\n[%s] thread[%x,%x] : to_buf %d / buffer %x / size %d / offset %d / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid,
-to_buffer, buffer, size, file_offset, cycle );
+{
+    if( to_buffer )
+    printk("\n[%s] thread[%x,%x] : mapper(%s) -> buffer(%x) / bytes %d / cycle %d\n",
+    __FUNCTION__, this->process->pid, this->trdid, name, buffer, size, cycle );
+    else
+    printk("\n[%s] thread[%x,%x] : buffer(%x) -> mapper(%s) / bytes %d / cycle %d\n",
+    __FUNCTION__, this->process->pid, this->trdid, buffer, name, size, cycle );
+}
 #endif
 
@@ -419,6 +430,6 @@
 #if (DEBUG_MAPPER_MOVE_USER & 1)
 if( DEBUG_MAPPER_MOVE_USER < cycle )
-printk("\n[%s] thread[%x,%x] : first_page %d / last_page %d\n",
-__FUNCTION__, this->process->pid, this->trdid, first, last );
+printk("\n[%s] thread[%x,%x] : mapper(%x,%x) / first_page %d / last_page %d\n",
+__FUNCTION__, this->process->pid, this->trdid, mapper_cxy, mapper_ptr, first, last );
 #endif
 
@@ -440,5 +451,5 @@
 #if (DEBUG_MAPPER_MOVE_USER & 1)
 if( DEBUG_MAPPER_MOVE_USER < cycle )
-printk("\n[%s] thread[%x,%x] : page_id = %d / page_offset = %d / page_count = %d\n",
+printk("\n[%s] thread[%x,%x] : page_id %d / page_offset %d / bytes %d\n",
 __FUNCTION__, this->process->pid, this->trdid, page_id , page_offset , page_count );
 #endif
@@ -449,15 +460,15 @@
         if ( page_xp == XPTR_NULL ) return -1;
 
+        // compute cluster and pointers on page in mapper
+        xptr_t     map_xp  = ppm_page2base( page_xp );
+        uint8_t  * map_ptr = GET_PTR( map_xp );
+        cxy_t      map_cxy = GET_CXY( map_xp );
+
 #if (DEBUG_MAPPER_MOVE_USER & 1)
 if( DEBUG_MAPPER_MOVE_USER < cycle )
-printk("\n[%s] thread[%x,%x] : get page (%x,%x) from mapper\n",
-__FUNCTION__, this->process->pid, this->trdid, GET_CXY(page_xp), GET_PTR(page_xp) );
-#endif
-
-        // compute pointer in mapper
-        xptr_t    base_xp = ppm_page2base( page_xp );
-        uint8_t * map_ptr = (uint8_t *)GET_PTR( base_xp ) + page_offset;
-
-        // compute pointer in buffer
+printk("\n[%s] thread[%x,%x] : get buffer(%x,%x) in mapper\n",
+__FUNCTION__, this->process->pid, this->trdid, map_cxy, map_ptr );
+#endif
+        // compute pointer in user buffer
         uint8_t * buf_ptr = (uint8_t *)buffer + done;
 
@@ -465,10 +476,27 @@
         if( to_buffer )
         {
-            hal_copy_to_uspace( buf_ptr , map_ptr , page_count ); 
+            hal_copy_to_uspace( map_cxy , map_ptr , buf_ptr , page_count ); 
+
+#if DEBUG_MAPPER_MOVE_USER & 1
+if( DEBUG_MAPPER_MOVE_USER < cycle )
+printk("\n[%s] thread[%x,%x] moved %d bytes / mapper %s (%x,%x) -> user buffer(%x,%x)\n",
+__FUNCTION__, this->process->pid, this->trdid, page_count,
+name, map_cxy, map_ptr, local_cxy, buf_ptr );
+#endif
+
         }
         else
         {
             ppm_page_do_dirty( page_xp ); 
-            hal_copy_from_uspace( map_ptr , buf_ptr , page_count ); 
+            hal_copy_from_uspace( map_cxy , map_ptr , buf_ptr , page_count ); 
+
+#if DEBUG_MAPPER_MOVE_USER & 1
+if( DEBUG_MAPPER_MOVE_USER < cycle )
+printk("\n[%s] thread[%x,%x] moved %d bytes / user buffer(%x,%x) -> mapper %s (%x,%x)\n",
+__FUNCTION__, this->process->pid, this->trdid, page_count,
+local_cxy, buf_ptr, name, map_cxy, map_ptr );
+mapper_display_page(  mapper_xp , page_id, 128 );
+#endif
+
         }
 
@@ -477,8 +505,14 @@
 
 #if DEBUG_MAPPER_MOVE_USER
-cycle = (uint32_t)hal_get_cycles();
+cycle      = (uint32_t)hal_get_cycles();
 if( DEBUG_MAPPER_MOVE_USER < cycle )
-printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, cycle );
+{
+    if( to_buffer )
+    printk("\n[%s] thread[%x,%x] completed mapper(%s) -> buffer(%x) / cycle %d\n",
+    __FUNCTION__, this->process->pid, this->trdid, name, buffer, cycle );
+    else
+    printk("\n[%s] thread[%x,%x] completed buffer(%x) -> mapper(%s) / cycle %d\n",
+    __FUNCTION__, this->process->pid, this->trdid, buffer, name, cycle );
+}
 #endif
 
@@ -717,5 +751,5 @@
 #if DEBUG_MAPPER_SYNC
 if( cycle > DEBUG_MAPPER_SYNC )
-printk("\n[%s] thread[%x,%x] synchonise page %d of <%s> to device\n",
+printk("\n[%s] thread[%x,%x] synchonise page %d of <%s> to IOC device\n",
 __FUNCTION__, this->process->pid, this->trdid, page->index, name );
 #endif
@@ -804,5 +838,6 @@
     // display 8 words per line
     tabi = (uint32_t *)buffer;
-    printk("\n***** <%s> first %d bytes of page %d *****\n", name, nbytes, page_id );
+    printk("\n***** mapper <%s> / %d bytes in page %d (%x,%x)\n",
+    name, nbytes, page_id, GET_CXY(base_xp), GET_PTR(base_xp) );
     for( line = 0 ; line < (nbytes >> 5) ; line++ )
     {
