Index: /trunk/softs/tsar_boot/Makefile
===================================================================
--- /trunk/softs/tsar_boot/Makefile	(revision 800)
+++ /trunk/softs/tsar_boot/Makefile	(revision 801)
@@ -115,5 +115,5 @@
 $(BUILD_DIR)/preloader.ld: preloader.ld.in
 	$(ECHO) "[   CC    ]     $(notdir $<)"
-	$(CC) -DUSE_DT=$(USE_DT) -x c $(INCLUDE) -E $< | $(SED) -e '/#/d' -e '/^[\s\t]*$$/d' > $@
+	$(CC) -x c -P -E -DUSE_DT=$(USE_DT) $(INCLUDE) $< -o $@
 
 $(TARGET): $(BUILD_DIR) $(OBJS) $(BUILD_DIR)/preloader.ld $(BUILD_DIR)/$(DRV_LIB)
Index: /trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h
===================================================================
--- /trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h	(revision 800)
+++ /trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h	(revision 801)
@@ -8,4 +8,5 @@
 #define X_WIDTH                4
 #define Y_WIDTH                4
+#define P_WIDTH                1
 #define X_IO                   0
 #define Y_IO                   0
Index: /trunk/softs/tsar_boot/conf/platform_tsar_generic_iob/hard_config.h
===================================================================
--- /trunk/softs/tsar_boot/conf/platform_tsar_generic_iob/hard_config.h	(revision 800)
+++ /trunk/softs/tsar_boot/conf/platform_tsar_generic_iob/hard_config.h	(revision 801)
@@ -10,4 +10,5 @@
 #define X_WIDTH                4
 #define Y_WIDTH                4
+#define P_WIDTH                2
 #define X_IO                   0
 #define Y_IO                   0
Index: /trunk/softs/tsar_boot/include/defs.h
===================================================================
--- /trunk/softs/tsar_boot/include/defs.h	(revision 800)
+++ /trunk/softs/tsar_boot/include/defs.h	(revision 801)
@@ -32,6 +32,6 @@
  */
 
-#ifndef NB_PROCS_MAX
-#   error "NB_PROCS_MAX constant must be defined in hard_config.h"
+#ifndef P_WIDTH
+#   error "P_WIDTH constant must be defined in the hard_config.h file"
 #endif
 
Index: /trunk/softs/tsar_boot/src/reset.S
===================================================================
--- /trunk/softs/tsar_boot/src/reset.S	(revision 800)
+++ /trunk/softs/tsar_boot/src/reset.S	(revision 801)
@@ -79,15 +79,15 @@
     mtc0    k0,     CP0_STATUS
 
-    /* All processors compute pid, lpid, cluster_xy */
+    /*
+     * All processors compute gpid, lpid, cluster_xy
+     * gpid = ebase[9:0] = X_WIDTH : Y_WIDTH : P_WIDTH
+     *                        x         y       lpid
+     * X, Y and LPID fields are left-aligned
+     */
 
     mfc0    k0,     CP0_EBASE
-    andi    t0,     k0,     0x3FF    /* t0 <= pid (at most 1024 procs)      */
-
-    move    t3,     t0
-
-    la      k0,     NB_PROCS_MAX     /* k0 <= # of processors per cluster   */
-    divu    t3,     k0
-    mfhi    t1                       /* t1 <= lpid       = pid % NB_PROCS   */
-    mflo    t2                       /* t2 <= cluster_xy = pid / NB_PROCS   */
+    andi    t0,     k0,     0x3FF            /* t0 <= gpid (<= 1024 procs)  */
+    andi    t1,     t0,     ((1<<P_WIDTH)-1) /* t1 <= lpid                  */
+    srl     t2,     t0,     P_WIDTH          /* t2 <= cluster_xy            */
 
     /* All processors initialise the count register in CP0 */
