Index: soft/giet_vm/boot/boot_init.c
===================================================================
--- soft/giet_vm/boot/boot_init.c	(revision 203)
+++ soft/giet_vm/boot/boot_init.c	(revision 204)
@@ -286,5 +286,6 @@
 void boot_puts(const char *buffer) 
 {
-    unsigned int* tty_address = (unsigned int*)&seg_tty_base;
+    unsigned int* tty_address = (unsigned int*)( (unsigned)&seg_tty_base +
+                                     (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     unsigned int n;
 
@@ -297,8 +298,8 @@
 } 
 ////////////////////////////////////////////////////////////////////////////
-// boot_putw() 
+// boot_putx() 
 // (it uses TTY0)
 ////////////////////////////////////////////////////////////////////////////
-void boot_putw(unsigned int val)
+void boot_putx(unsigned int val)
 {
     static const char   HexaTab[] = "0123456789ABCDEF";
@@ -316,4 +317,32 @@
     }
     boot_puts(buf);
+}
+////////////////////////////////////////////////////////////////////////////
+// boot_putd() 
+// (it uses TTY0)
+////////////////////////////////////////////////////////////////////////////
+void boot_putd(unsigned int val)
+{
+    static const char   DecTab[] = "0123456789";
+    char                buf[11];
+    unsigned int        i;
+    unsigned int        first;
+
+    buf[10] = 0;
+
+    for ( i = 0 ; i < 10 ; i++ )
+    {
+        if ((val != 0) || (i == 0))
+        {
+            buf[9-i] = DecTab[val % 10];
+            first    = 9-i;
+        }
+        else
+        {
+            break;
+        }
+        val /= 10;
+    }
+    boot_puts( &buf[first] );
 }
 
@@ -495,5 +524,5 @@
     {
         boot_puts("Unfound page table for vspace ");
-        boot_putw(vspace_id);
+        boot_putd(vspace_id);
         boot_puts("\n");
         boot_exit();
@@ -530,6 +559,9 @@
     if ( ( *pt_flags & PTE_V) != 0 )    // page already mapped
     {
-        boot_puts("\n[BOOT ERROR] in boot_add_pte() function\n");
-        boot_puts("page already mapped\n");
+        boot_puts("\n[BOOT ERROR] double mapping in vspace ");
+        boot_putd( vspace_id );
+        boot_puts(" for vpn = ");
+        boot_putx( vpn );
+        boot_puts("\n");
         boot_exit();
     }
@@ -579,9 +611,9 @@
 boot_puts( vseg[vseg_id].name );
 boot_puts(" : flags = ");
-boot_putw( flags );
+boot_putx( flags );
 boot_puts(" / npages = ");
-boot_putw( npages );
+boot_putd( npages );
 boot_puts(" / pbase = ");
-boot_putw( vseg[vseg_id].pbase );
+boot_putx( vseg[vseg_id].pbase );
 boot_puts("\n");
 #endif        
@@ -615,9 +647,9 @@
 boot_puts( vseg[vseg_id].name );
 boot_puts(" / flags = ");
-boot_putw( flags );
+boot_putx( flags );
 boot_puts(" / npages = ");
-boot_putw( npages );
+boot_putd( npages );
 boot_puts(" / pbase = ");
-boot_putw( vseg[vseg_id].pbase );
+boot_putx( vseg[vseg_id].pbase );
 boot_puts("\n");
 #endif        
@@ -720,5 +752,5 @@
                 boot_puts( "\n[BOOT ERROR] in boot_vseg_map() function, " );
                 boot_puts("PTAB too small, minumum size is: ");
-                boot_putw( PT1_SIZE + PT2_SIZE);
+                boot_putx( PT1_SIZE + PT2_SIZE);
                 boot_exit();
             }
@@ -750,14 +782,14 @@
         boot_puts("\n"); 
         boot_puts("vseg pbase = ");
-        boot_putw( vseg->pbase ); 
+        boot_putx( vseg->pbase ); 
         boot_puts("\n"); 
         boot_puts("vseg length = ");
-        boot_putw( vseg->length ); 
+        boot_putx( vseg->length ); 
         boot_puts("\n"); 
         boot_puts("pseg pbase = ");
-        boot_putw( pseg->base ); 
+        boot_putx( pseg->base ); 
         boot_puts("\n"); 
         boot_puts("pseg length = ");
-        boot_putw( pseg->length ); 
+        boot_putx( pseg->length ); 
         boot_puts("\n"); 
         boot_exit();
@@ -771,9 +803,9 @@
 boot_puts( vseg->name );
 boot_puts(" : len = ");
-boot_putw( vseg->length );
+boot_putx( vseg->length );
 boot_puts(" / vbase = ");
-boot_putw( vseg->vbase );
+boot_putx( vseg->vbase );
 boot_puts(" / pbase = ");
-boot_putw( vseg->pbase );
+boot_putx( vseg->pbase );
 boot_puts("\n");
 #endif  
@@ -795,5 +827,5 @@
     {
         boot_puts("\n[BOOT ERROR] Illegal mapping signature: ");
-        boot_putw(header->signature);
+        boot_putx(header->signature);
         boot_puts("\n");
         boot_exit();
@@ -805,7 +837,7 @@
         boot_puts("\n[BOOT ERROR] Incoherent NB_CLUSTERS");
         boot_puts("\n             - In giet_config,  value = ");
-        boot_putw ( NB_CLUSTERS );
+        boot_putd ( NB_CLUSTERS );
         boot_puts("\n             - In mapping_info, value = ");
-        boot_putw ( header->clusters );
+        boot_putd ( header->clusters );
         boot_puts("\n");
         boot_exit();
@@ -823,5 +855,4 @@
     unsigned int periph_id;
     unsigned int cluster_id;
-    unsigned int channels;
     unsigned int tty_found = 0;
     unsigned int nic_found = 0;
@@ -832,7 +863,7 @@
         {
             boot_puts("\n[BOOT ERROR] too much processors in cluster ");
-            boot_putw( cluster_id );
+            boot_putd( cluster_id );
             boot_puts(" : procs = ");
-            boot_putw ( cluster[cluster_id].procs );
+            boot_putd ( cluster[cluster_id].procs );
             boot_puts("\n");
             boot_exit();
@@ -854,7 +885,7 @@
                 {
                     boot_puts("\n[BOOT ERROR] Wrong NB_TTYS in cluster ");
-                    boot_putw( cluster_id );
+                    boot_putd( cluster_id );
                     boot_puts(" : ttys = ");
-                    boot_putw ( periph[periph_id].channels );
+                    boot_putd ( periph[periph_id].channels );
                     boot_puts("\n");
                     boot_exit();
@@ -873,7 +904,7 @@
                 {
                     boot_puts("\n[BOOT ERROR] Wrong NB_NICS in cluster ");
-                    boot_putw( cluster_id );
+                    boot_putd( cluster_id );
                     boot_puts(" : nics = ");
-                    boot_putw ( periph[periph_id].channels );
+                    boot_putd ( periph[periph_id].channels );
                     boot_puts("\n");
                     boot_exit();
@@ -887,7 +918,7 @@
                 {
                     boot_puts("\n[BOOT ERROR] Too much user timers in cluster ");
-                    boot_putw( cluster_id );
+                    boot_putd( cluster_id );
                     boot_puts(" : timers = ");
-                    boot_putw ( periph[periph_id].channels );
+                    boot_putd ( periph[periph_id].channels );
                     boot_puts("\n");
                     boot_exit();
@@ -900,7 +931,7 @@
                 {
                     boot_puts("\n[BOOT ERROR] Too much DMA channels in cluster ");
-                    boot_putw( cluster_id );
+                    boot_putd( cluster_id );
                     boot_puts(" : channels = ");
-                    boot_putw ( periph[periph_id].channels );
+                    boot_putd ( periph[periph_id].channels );
                     boot_puts("\n");
                     boot_exit();
@@ -937,5 +968,5 @@
         {
             boot_puts("\n[BOOT ERROR] The number of processors in cluster ");
-            boot_putw( cluster_id );
+            boot_putd( cluster_id );
             boot_puts(" is larger than NB_PROCS_MAX \n");
             boot_exit();
@@ -959,9 +990,9 @@
 #if BOOT_DEBUG_PT
 boot_puts("cluster ");
-boot_putw(cluster_id);
+boot_putd(cluster_id);
 boot_puts(" / pseg ");
 boot_puts(pseg[pseg_id].name);
 boot_puts(" : next_base = ");
-boot_putw(pseg[pseg_id].next_base);
+boot_putx(pseg[pseg_id].next_base);
 boot_puts("\n");
 #endif
@@ -1028,7 +1059,7 @@
 #if BOOT_DEBUG_PT
 boot_puts("\n>>> page table physical address = ");
-boot_putw((unsigned int)boot_ptabs_paddr[vspace_id]);
+boot_putx((unsigned int)boot_ptabs_paddr[vspace_id]);
 boot_puts(", page table number of PT2 = ");
-boot_putw((unsigned int)boot_max_pt2[vspace_id]);
+boot_putd((unsigned int)boot_max_pt2[vspace_id]);
 boot_puts("\n");
 #endif
@@ -1082,7 +1113,7 @@
 boot_puts( vobj[vobj_id].name);
 boot_puts(" / depth = ");
-boot_putw( mwmr->depth );
+boot_putd( mwmr->depth );
 boot_puts(" / width = ");
-boot_putw( mwmr->width );
+boot_putd( mwmr->width );
 boot_puts("\n");
 #endif
@@ -1095,5 +1126,5 @@
 boot_puts( vobj[vobj_id].name);
 boot_puts(" / length = ");
-boot_putw( vobj[vobj_id].length ); 
+boot_putx( vobj[vobj_id].length ); 
 boot_puts("\n");
 #endif
@@ -1106,5 +1137,5 @@
 boot_puts( vobj[vobj_id].name);
 boot_puts(" / length = ");
-boot_putw( vobj[vobj_id].length ); 
+boot_putx( vobj[vobj_id].length ); 
 boot_puts("\n");
 #endif
@@ -1120,5 +1151,5 @@
 boot_puts( vobj[vobj_id].name);
 boot_puts(" / init_value = ");
-boot_putw( barrier->init );
+boot_putd( barrier->init );
 boot_puts("\n");
 #endif
@@ -1142,5 +1173,5 @@
 boot_puts( vobj[vobj_id].name);
 boot_puts(" / length = ");
-boot_putw( vobj[vobj_id].length ); 
+boot_putx( vobj[vobj_id].length ); 
 boot_puts("\n");
 #endif
@@ -1154,5 +1185,5 @@
 boot_puts( vobj[vobj_id].name);
 boot_puts(" / length = ");
-boot_putw( vobj[vobj_id].length ); 
+boot_putx( vobj[vobj_id].length ); 
 boot_puts("\n");
 #endif
@@ -1173,5 +1204,5 @@
         {
             boot_puts("\n[INIT ERROR] Missing PTAB for vspace ");
-            boot_putw( vspace_id );
+            boot_putd( vspace_id );
             boot_exit();
         }
@@ -1185,5 +1216,4 @@
     volatile unsigned int *cbase = (unsigned int*) coproc;
     
-
     cbase[MWMR_CONFIG_FIFO_WAY] = way ;
     cbase[MWMR_CONFIG_FIFO_NO] = no ;
@@ -1222,5 +1252,5 @@
 #if BOOT_DEBUG_PERI
 boot_puts("\n[BOOT DEBUG] ****** peripheral initialisation in cluster "); 
-boot_putw( cluster_id );
+boot_putd( cluster_id );
 boot_puts(" ******\n");
 #endif
@@ -1245,5 +1275,5 @@
 #if BOOT_DEBUG_PERI
 boot_puts("- IOC initialised : ");
-boot_putw( channels );
+boot_putd( channels );
 boot_puts(" channels\n");
 #endif
@@ -1261,5 +1291,5 @@
 #if BOOT_DEBUG_PERI
 boot_puts("- DMA initialised : ");
-boot_putw( channels );
+boot_putd( channels );
 boot_puts(" channels\n");
 #endif
@@ -1276,5 +1306,5 @@
 #if BOOT_DEBUG_PERI
 boot_puts("- NIC initialised : ");
-boot_putw( channels );
+boot_putd( channels );
 boot_puts(" channels\n");
 #endif
@@ -1298,5 +1328,5 @@
 #if BOOT_DEBUG_PERI
 boot_puts("- IOB initialised : ");
-boot_putw( channels );
+boot_putd( channels );
 boot_puts(" channels\n");
 #endif
@@ -1304,5 +1334,5 @@
 
         } // end for periphs
-/*
+
         for ( coproc_id = cluster[cluster_id].coproc_offset ;
               coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs ;
@@ -1315,7 +1345,7 @@
 #if BOOT_DEBUG_PERI
 boot_puts("[BOOT] mwmr coproc initialisation of ");
-boot_putw((unsigned int) coproc[coproc_id].name);
+boot_putx((unsigned int) coproc[coproc_id].name);
 boot_puts(", nb ports");
-boot_putw((unsigned int)coproc[coproc_id].ports);
+boot_putd((unsigned int)coproc[coproc_id].ports);
 boot_puts("\n");
 #endif
@@ -1356,5 +1386,5 @@
             }
         } // end for coprocs
-*/
+
     } // end for clusters
 } // end boot_peripherals_init()
@@ -1417,5 +1447,5 @@
 #if BOOT_DEBUG_SCHED
 boot_puts("\n[BOOT DEBUG] Initialise schedulers / IT vector in cluster ");
-boot_putw( cluster_id );
+boot_putd( cluster_id );
 boot_puts("\n");
 #endif
@@ -1440,5 +1470,5 @@
         {
             boot_puts("\n[BOOT ERROR] Missing RAM pseg in cluster ");
-            boot_putw( cluster_id );
+            boot_putd( cluster_id );
             boot_puts("\n");
             boot_exit();
@@ -1459,7 +1489,7 @@
 #if BOOT_DEBUG_SCHED
 boot_puts("\nProc ");
-boot_putw( proc_id );
+boot_putd( proc_id );
 boot_puts(" : scheduler pbase = ");
-boot_putw( pseg_pbase + (proc_id<<12) );
+boot_putx( pseg_pbase + (proc_id<<12) );
 boot_puts("\n");
 #endif
@@ -1488,11 +1518,11 @@
 #if BOOT_DEBUG_SCHED
 boot_puts("- IRQ : icu = ");
-boot_putw( icu_id );
+boot_putd( icu_id );
 boot_puts(" / type = ");
-boot_putw( type );
+boot_putd( type );
 boot_puts(" / isr = ");
-boot_putw( isr_id );
+boot_putd( isr_id );
 boot_puts(" / channel = ");
-boot_putw( channel );
+boot_putd( channel );
 boot_puts("\n");
 #endif
@@ -1627,7 +1657,7 @@
             {
                 boot_puts("\n[BOOT ERROR] : ");
-                boot_putw( ltid );
+                boot_putd( ltid );
                 boot_puts(" tasks allocated to processor ");
-                boot_putw( gpid );
+                boot_putd( gpid );
                 boot_puts(" / max is 15\n");
                 boot_exit();
@@ -1659,51 +1689,51 @@
 boot_puts( task[task_id].name );
 boot_puts(" allocated to processor ");
-boot_putw( gpid );
+boot_putd( gpid );
 boot_puts("  - ctx[LTID]   = ");
-boot_putw( ltid );
+boot_putd( ltid );
 boot_puts("\n");
 
 boot_puts("  - ctx[SR]     = ");
-boot_putw( ctx_sr );
+boot_putx( ctx_sr );
 boot_puts("\n");
 
 boot_puts("  - ctx[SR]     = ");
-boot_putw( ctx_sp );
+boot_putx( ctx_sp );
 boot_puts("\n");
 
 boot_puts("  - ctx[RA]     = ");
-boot_putw( ctx_ra );
+boot_putx( ctx_ra );
 boot_puts("\n");
 
 boot_puts("  - ctx[EPC]    = ");
-boot_putw( ctx_epc );
+boot_putx( ctx_epc );
 boot_puts("\n");
 
 boot_puts("  - ctx[PTPR]   = ");
-boot_putw( ctx_ptpr );
+boot_putx( ctx_ptpr );
 boot_puts("\n");
 
 boot_puts("  - ctx[TTY]    = ");
-boot_putw( ctx_tty );
+boot_putd( ctx_tty );
 boot_puts("\n");
 
 boot_puts("  - ctx[NIC]    = ");
-boot_putw( ctx_nic );
+boot_putd( ctx_nic );
 boot_puts("\n");
 
 boot_puts("  - ctx[TIMER]  = ");
-boot_putw( ctx_timer );
+boot_putd( ctx_timer );
 boot_puts("\n");
 
 boot_puts("  - ctx[FBDMA]  = ");
-boot_putw( ctx_fbdma );
+boot_putd( ctx_fbdma );
 boot_puts("\n");
 
 boot_puts("  - ctx[PTAB]   = ");
-boot_putw( ctx_ptab );
+boot_putx( ctx_ptab );
 boot_puts("\n");
 
 boot_puts("  - ctx[VSID]   = ");
-boot_putw( vspace_id );
+boot_putd( vspace_id );
 boot_puts("\n");
 
@@ -1732,5 +1762,5 @@
 
     boot_puts("\n[BOOT] Mapping check completed at cycle ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
@@ -1739,5 +1769,5 @@
 
     boot_puts("\n[BOOT] Pseg allocators initialisation completed at cycle ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
@@ -1746,5 +1776,5 @@
 
     boot_puts("\n[BOOT] Page Tables initialisation completed at cycle ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
@@ -1753,5 +1783,5 @@
 
     boot_puts("\n[BOOT] Vobjs initialisation completed at cycle : ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
@@ -1760,5 +1790,5 @@
 
     boot_puts("\n[BOOT] Peripherals initialisation completed at cycle ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
@@ -1768,5 +1798,5 @@
 
     boot_puts("\n[BOOT] MMU activation completed at cycle ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
@@ -1775,5 +1805,5 @@
 
     boot_puts("\n[BOOT] Schedulers initialisation completed at cycle ");
-    boot_putw( boot_proctime() );
+    boot_putd( boot_proctime() );
     boot_puts("\n");
 
