Index: trunk/tools/bootloader_tsar/boot.c
===================================================================
--- trunk/tools/bootloader_tsar/boot.c	(revision 279)
+++ trunk/tools/bootloader_tsar/boot.c	(revision 296)
@@ -105,10 +105,10 @@
 // kernel segments layout variables
 
-uint32_t                        seg_kcode_base;  // kcode segment base address
-uint32_t                        seg_kcode_size;  // kcode segment size (bytes) 
-uint32_t                        seg_kdata_base;  // kdata segment base address
-uint32_t                        seg_kdata_size;  // kdata segment size (bytes) 
-uint32_t                        seg_kgiet_base;  // kcode segment base address
-uint32_t                        seg_kgiet_size;  // kcode segment size (bytes) 
+uint32_t                        seg_kcode_base;   // kcode segment base address
+uint32_t                        seg_kcode_size;   // kcode segment size (bytes) 
+uint32_t                        seg_kdata_base;   // kdata segment base address
+uint32_t                        seg_kdata_size;   // kdata segment size (bytes) 
+uint32_t                        seg_kentry_base;  // kcode segment base address
+uint32_t                        seg_kentry_size;  // kcode segment size (bytes) 
 
 uint32_t                        kernel_entry;    // kernel entry point
@@ -175,5 +175,5 @@
 /**************************************************************************************
  * This function loads the 'kernel.elf' file into the boot cluster memory buffer,
- * analyzes it, and places the three kcode, kgiet, kdata segments at their final
+ * analyzes it, and places the three kcode, kentry, kdata segments at their final
  * physical adresses (defined the .elf file).        
  * It set the global variables defining the kernel layout.
@@ -192,5 +192,5 @@
     bool_t       kcode_found;     // kcode segment found.
     bool_t       kdata_found;     // kdata segment found.
-    bool_t       kgiet_found;     // kgiet segment found.
+    bool_t       kentry_found;    // kentry segment found.
     uint32_t     seg_id;          // iterator for segments loop.
 
@@ -231,7 +231,7 @@
 
     // loop on segments
-    kcode_found = false;
-    kdata_found = false;
-    kgiet_found = false;
+    kcode_found  = false;
+    kdata_found  = false;
+    kentry_found = false;
     for (seg_id = 0; seg_id < segments_nb; seg_id++) 
     {
@@ -265,10 +265,10 @@
 
             // Note: we suppose that the 'kernel.elf' file contains exactly
-            // three loadable segments ktext, kgiet, & kdata:
-            // - the kcode segment is read-only and base < 0x80000000
-            // - the kgiet segment is read-only and base >= 0x8000000
+            // three loadable segments ktext, kentry, & kdata:
+            // - the kcode segment is read-only and base == KCODE_BASE
+            // - the kentry segment is read-only and base == KENTRY_BASE
 
             if( ((program_header[seg_id].p_flags & PF_W) == 0) &&
-                 (program_header[seg_id].p_paddr < 0x80000000) )     // kcode segment
+                 (program_header[seg_id].p_paddr == KCODE_BASE) )     // kcode segment
             {
                 if( kcode_found )
@@ -284,17 +284,17 @@
                 seg_kcode_size = seg_memsz;
             }
-            else if( program_header[seg_id].p_paddr >= 0x80000000 ) // kgiet segment
-            {
-                if( kgiet_found )
+            else if( program_header[seg_id].p_paddr == KENTRY_BASE ) // kentry segment
+            {
+                if( kentry_found )
                 {
                     boot_printf("\n[BOOT_ERROR] in %s for file %s :\n"
-                                "   two kgiet segments found\n",
+                                "   two kentry segments found\n",
                                 __FUNCTION__ , KERNEL_PATHNAME );
                     boot_exit();
                 } 
 
-                kgiet_found     = true;
-                seg_kgiet_base = seg_paddr;
-                seg_kgiet_size = seg_memsz;
+                kentry_found     = true;
+                seg_kentry_base = seg_paddr;
+                seg_kentry_size = seg_memsz;
             }
             else                                                    // kdata segment
@@ -322,7 +322,7 @@
         boot_exit();
     }
-    if( kgiet_found == false )
-    {
-        boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kgiet not found\n",
+    if( kentry_found == false )
+    {
+        boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kentry not found\n",
                     __FUNCTION__ , KERNEL_PATHNAME );
         boot_exit();
@@ -333,4 +333,18 @@
                     __FUNCTION__ , KERNEL_PATHNAME );
         boot_exit();
+    }
+
+    // check segments sizes
+    if( seg_kentry_size > KENTRY_MAX_SIZE )
+    {
+        boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kentry too large\n",
+                    __FUNCTION__ , KERNEL_PATHNAME );
+        boot_exit();
+    }
+
+    if( (seg_kcode_size + seg_kdata_size) > KCODE_MAX_SIZE )
+    {
+        boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kcode + seg_kdata too large\n",
+                    __FUNCTION__ , KERNEL_PATHNAME );
     }
 
@@ -388,8 +402,10 @@
 
     // Initialize kernel segments from global variables
-    boot_info->kernel_code_start = seg_kcode_base;
-    boot_info->kernel_code_end   = seg_kcode_base + seg_kcode_size;
-    boot_info->kernel_data_start = seg_kdata_base;
-    boot_info->kernel_data_end   = seg_kdata_base + seg_kdata_size;
+    boot_info->kcode_base  = seg_kcode_base;
+    boot_info->kcode_size  = seg_kcode_size;
+    boot_info->kdata_base  = seg_kdata_base;
+    boot_info->kdata_size  = seg_kdata_size;
+    boot_info->kentry_base = seg_kentry_base;
+    boot_info->kentry_size = seg_kentry_size;
 
     // loop on arch_info clusters to get relevant pointers
@@ -604,6 +620,5 @@
 
    // Get the top address of the kernel segments
-    end = (boot_info->kernel_code_end > boot_info->kernel_data_end ) ?
-          boot_info->kernel_code_end : boot_info->kernel_data_end;
+    end = boot_info->kdata_base + boot_info->kdata_size;
 
     // compute number of physical pages occupied by the kernel code 
@@ -611,11 +626,6 @@
                  (end >> CONFIG_PPM_PAGE_SHIFT) : (end >> CONFIG_PPM_PAGE_SHIFT) + 1;
 
-    // set one reserved zone for giet code
-    uint32_t first_page = seg_kgiet_base >> CONFIG_PPM_PAGE_SHIFT;
-    uint32_t last_page  = (seg_kgiet_base + seg_kgiet_size - 1) >> CONFIG_PPM_PAGE_SHIFT;
-
-    boot_info->rsvd_nr = 1;
-    boot_info->rsvd[0].first_page = first_page;
-    boot_info->rsvd[0].npages     = last_page - first_page + 1;
+    // no reserved sones for TSAR architecture
+    boot_info->rsvd_nr = 0;
 
     // set boot_info signature
@@ -697,5 +707,5 @@
 
 #if DEBUG_BOOT_WAKUP
-boot_printf("\n[BOOT] core[%x][0] activated at cycle %d\n",
+boot_printf("\n[BOOT] core[%x,0] activated at cycle %d\n",
             cluster->cxy , boot_get_proctime );
 #endif
@@ -726,5 +736,5 @@
 
 #if DEBUG_BOOT_WAKUP
-boot_printf("\n[BOOT] core[%x][%d] activated at cycle %d\n",
+boot_printf("\n[BOOT] core[%x,%d] activated at cycle %d\n",
              boot_info->cxy , core_id , boot_get_proctime() );
 #endif
@@ -754,5 +764,5 @@
         if (cxy == BOOT_CORE_CXY)
         {
-            boot_printf("\n[BOOT] core[%x][%d] enters at cycle %d\n",
+            boot_printf("\n[BOOT] core[%x,%d] enters at cycle %d\n",
                         cxy , lid , boot_get_proctime() );
 
@@ -775,5 +785,5 @@
             boot_kernel_load();
 
-            boot_printf("\n[BOOT] core[%x][%d] loaded kernel at cycle %d\n",
+            boot_printf("\n[BOOT] core[%x,%d] loaded kernel at cycle %d\n",
                         cxy , lid , boot_get_proctime() );
 
@@ -791,5 +801,5 @@
             if (boot_info->signature != BOOT_INFO_SIGNATURE)
             {
-                boot_printf("\n[BOOT ERROR] in %s reported by core[%x][%d]\n"
+                boot_printf("\n[BOOT ERROR] in %s reported by core[%x,%d]\n"
                             "  illegal boot_info signature / should be %x\n",
                             __FUNCTION__ , cxy , lid , BOOT_INFO_SIGNATURE );
@@ -797,5 +807,5 @@
             }
 
-            boot_printf("\n[BOOT] core[%x][%d] loaded boot_info at cycle %d\n",
+            boot_printf("\n[BOOT] core[%x,%d] loaded boot_info at cycle %d\n",
                         cxy , lid , boot_get_proctime() );
 
@@ -812,4 +822,12 @@
             // activate other local cores
             boot_wake_local_cores( boot_info );
+
+// display address extensions
+uint32_t cp2_data_ext;
+uint32_t cp2_ins_ext;
+asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
+asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
+boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
+            cxy , lid , cp2_data_ext , cp2_ins_ext );
 
             // Wait until all local cores in cluster ready
@@ -832,8 +850,8 @@
 
             // from now, it is safe to refer to the boot code global variables 
-            boot_printf("\n[BOOT] core[%x][%d] replicated boot code at cycle %d\n",
+            boot_printf("\n[BOOT] core[%x,%d] replicated boot code at cycle %d\n",
                         cxy , lid , boot_get_proctime() );
 
-            // switch to the INSTRUCTION local memory space, to avoid contention.
+			// switch to the INSTRUCTION local memory space, to avoid contention.
             asm volatile("mtc2  %0, $25" :: "r"(cxy));
 
@@ -843,5 +861,5 @@
                                ARCHINFO_MAX_SIZE );
 
-            boot_printf("\n[BOOT] core[%x][%d] replicated arch_info at cycle %d\n",
+            boot_printf("\n[BOOT] core[%x,%d] replicated arch_info at cycle %d\n",
                         cxy , lid , boot_get_proctime() );
 
@@ -856,5 +874,5 @@
                                 seg_kdata_size );
 
-            boot_printf("\n[BOOT] core[%x][%d] replicated kernel code at cycle %d\n",
+            boot_printf("\n[BOOT] core[%x,%d] replicated kernel code at cycle %d\n",
                         cxy , lid , boot_get_proctime() );
 
@@ -876,4 +894,12 @@
             // activate other local cores
             boot_wake_local_cores( boot_info );
+
+// display address extensions
+uint32_t cp2_data_ext;
+uint32_t cp2_ins_ext;
+asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
+asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
+boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
+            cxy , lid , cp2_data_ext , cp2_ins_ext );
 
             // Wait until all local cores in cluster ready
@@ -897,4 +923,12 @@
         // Check core information
         boot_check_core(boot_info, lid);
+
+// display address extensions
+uint32_t cp2_data_ext;
+uint32_t cp2_ins_ext;
+asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
+asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
+boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
+            cxy , lid , cp2_data_ext , cp2_ins_ext );
 
         // Wait until all local cores in cluster ready
@@ -911,4 +945,5 @@
     uint32_t pmask  = CONFIG_PPM_PAGE_MASK;
     uint32_t psize  = CONFIG_PPM_PAGE_SIZE;
+
 
     // compute base address of idle thread descriptors array
@@ -927,5 +962,5 @@
                   "ori   $26,  $26,  0xFFFF  \n"
                   "and   $27,  $27,  $26     \n"
-                  "mtc0  $27,  $12           \n" 
+                  "mtc0  $27,  $12           \n"
                   "move  $4,   %0            \n"
                   "move  $29,  %1            \n"
