Index: trunk/tools/bootloader_tsar/boot.c
===================================================================
--- trunk/tools/bootloader_tsar/boot.c	(revision 13)
+++ trunk/tools/bootloader_tsar/boot.c	(revision 50)
@@ -26,15 +26,15 @@
  *                                                                          *
  * It supports clusterised shared memory multi-processor architectures,     *
- * where each processor is identified by a composite index [cxy,lid],       *
+ * where each processor core is identified by a composite index [cxy,lid]   *
  * with one physical memory bank per cluster.                               *
  *                                                                          *
  * The 'boot.elf' file (containing the boot-loader binary code) is stored   *
- * on disk and is loaded into memory by bscpu (whose index is [0,0]),       *
- * executing the generic preloader.                                         *
+ * on disk and is loaded into memory by core[0,0] (cxy = 0 / lid = 0),      *
+ * and is copied in each other cluter by the local CP0 (lid = 0].           *
  *                                                                          *
- * 1) The boot-loader first phase is executed by bscpu only, while          *
+ * 1) The boot-loader first phase is executed by core[0,0], while           *
  *    all other cores are waiting in the preloader.                         *
  *    It does the following tasks:                                          *
- *      - load into the memory bank of cluster (0,0) the 'arch_info.bin'    *
+ *      - load into the memory bank of cluster 0 the 'arch_info.bin'        *
  *        file (containing the hardware architecture description) and the   *
  *        'kernel.elf' file, at temporary locations,                        *    
@@ -47,5 +47,5 @@
  *                                                                          *
  * 2) The boot-loader second phase is then executed in parallel by all      *
- *    CP0s (other than bscpu). Each CP0 performs the following tasks:       *
+ *    CP0s (other than core[0,0]). Each CP0 performs the following tasks:   *
  *      - copies into the memory bank of the local cluster the 'boot.elf',  *
  *        the 'arch_info.bin' (at the same addresses as the 'boot.elf' and  *
@@ -59,5 +59,5 @@
  * 3) The boot-loader third phase is executed in parallel by all cores.     *
  *    After passing the global barrier the bscpu:                           *
- *      - activates the CPi of cluster(0,0),                                *
+ *      - activates the CPi of cluster(0),                                  *
  *      - blocks on the local barrier waiting for all local CPi to report   *
  *        completion on the local barrier,                                  *
@@ -346,5 +346,6 @@
     archinfo_irq_t     * irq; 
     uint32_t             irq_id;
- 
+    uint32_t             end;
+    uint32_t             rsvd_pages; 
     boot_device_t      * boot_dev; 
 
@@ -364,5 +365,5 @@
     boot_info->io_cxy       = header->io_cxy;
 
-    // Initialize kernel segments
+    // 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;
@@ -505,31 +506,9 @@
         if (device->type == DEV_TYPE_RAM_SCL)
         {
-            // set total number of physical memory pages in cluster
-            boot_info->pages_nr = device->size >> CONFIG_PPM_PAGE_SHIFT;
-
-            // Get the last address allocated for the kernel segments
-            uint32_t end;
-            if( boot_info->kernel_code_end > boot_info->kernel_data_end )
-            {
-                end = boot_info->kernel_code_end;
-            }
-            else
-            {
-                end = boot_info->kernel_data_end;
-            }
-                
-            // Compute the number of pages allocated for the kernel.
-            if( (end & CONFIG_PPM_PAGE_MASK) == 0 )
-            {
-                boot_info->pages_offset = end >> CONFIG_PPM_PAGE_SHIFT;
-            }
-            else
-            {
-                boot_info->pages_offset = (end >> CONFIG_PPM_PAGE_SHIFT) + 1;
-            }
-
-#if DEBUG_BOOT_INFO
-boot_printf("  - RAM : %x pages / first free page = %x\n",
-            boot_info->pages_nr , boot_info->pages_offset );
+            // set number of physical memory pages 
+            boot_info->pages_nr   = device->size >> CONFIG_PPM_PAGE_SHIFT;
+
+#if DEBUG_BOOT_INFO
+boot_printf("  - RAM : %x pages\n", boot_info->pages_nr );
 #endif
         }
@@ -602,4 +581,22 @@
         }
     }  // end loop on local peripherals
+
+    // 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;
+
+    // Get the number of pages reserved to kernel segments 
+    rsvd_pages = ( (end & CONFIG_PPM_PAGE_MASK) == 0 ) ?
+                 (end >> CONFIG_PPM_PAGE_SHIFT) : (end >> CONFIG_PPM_PAGE_SHIFT) + 1;
+
+    // set the kernel code "reserved zonz"
+    boot_info->rsvd_nr = 1;
+    boot_info->rsvd[0].first_page = 0;
+    boot_info->rsvd[0].npages     = rsvd_pages;
+
+#if DEBUG_BOOT_INFO
+boot_printf("\n[BOOT INFO] %s : Kernel Reserved Zone / base = 0 / npages = %d at cycle %d\n", 
+            __FUNCTION__ , rsvd_pages ,boot_get_proctime() );
+#endif
 
     // set boot_info signature
