Index: boot/arch/arm32/loader/asm.h
===================================================================
--- boot/arch/arm32/loader/asm.h	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/arm32/loader/asm.h	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -33,5 +33,5 @@
 /** @file
  *  @brief Functions implemented in assembly.
- */ 
+ */
 
 
@@ -41,8 +41,8 @@
 
 /** Copies cnt bytes from dst to src.
- * 
+ *
  * @param dst Destination address.
  * @param src Source address.
- * @param cnt Count of bytes to be copied. 
+ * @param cnt Count of bytes to be copied.
  */
 #define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt))
@@ -59,10 +59,9 @@
 /** Jumps to the kernel entry point.
  *
- * @param entry          Kernel entry point address.
- * @param bootinfo       Structure holding information about loaded tasks.
- * @param bootinfo_size  Size of the bootinfo structure.
+ * @param entry    Kernel entry point address.
+ * @param bootinfo Structure holding information about loaded tasks.
+ *
  */
-extern void jump_to_kernel(void *entry, void *bootinfo,
-    unsigned int bootinfo_size) __attribute__((noreturn));
+extern void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn));
 
 
Index: boot/arch/arm32/loader/boot.S
===================================================================
--- boot/arch/arm32/loader/boot.S	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/arm32/loader/boot.S	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -54,4 +54,2 @@
 page_table:
 	.skip PTL0_ENTRIES * PTL0_ENTRY_SIZE
-
-
Index: boot/arch/arm32/loader/main.c
===================================================================
--- boot/arch/arm32/loader/main.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/arm32/loader/main.c	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -33,5 +33,5 @@
 /** @file
  *  @brief Bootstrap.
- */ 
+ */
 
 
@@ -40,4 +40,5 @@
 #include "_components.h"
 #include <printf.h>
+#include <align.h>
 #include <macros.h>
 
@@ -110,5 +111,5 @@
 	
 	printf("\nBooting the kernel...\n");
-	jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
+	jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo);
 }
 
Index: boot/arch/arm32/loader/main.h
===================================================================
--- boot/arch/arm32/loader/main.h	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/arm32/loader/main.h	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -33,5 +33,5 @@
 /** @file
  *  @brief Boot related declarations.
- */ 
+ */
 
 
@@ -39,11 +39,4 @@
 #define BOOT_arm32_MAIN_H
 
-
-/** Aligns to the nearest higher address.
- *
- * @param addr  Address or number to be aligned.
- * @param align Size of alignment, must be power of 2.
- */
-#define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
 
 /** Maximum number of tasks in the #bootinfo_t struct. */
@@ -75,3 +68,2 @@
 /** @}
  */
-
Index: boot/arch/mips32/loader/asm.h
===================================================================
--- boot/arch/mips32/loader/asm.h	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/mips32/loader/asm.h	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -30,10 +30,10 @@
 #define BOOT_mips32_ASM_H_
 
-#define PAGE_SIZE 16384
-#define PAGE_WIDTH 14
+#define PAGE_SIZE   16384
+#define PAGE_WIDTH  14
 
-#define memcpy(dst, src, cnt)	__builtin_memcpy((dst), (src), (cnt))
+#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
 
-void jump_to_kernel(void *entry, void *bootinfo, unsigned int bootinfo_size) __attribute__((noreturn));
+void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn));
 
 #endif
Index: boot/arch/mips32/loader/boot.S
===================================================================
--- boot/arch/mips32/loader/boot.S	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/mips32/loader/boot.S	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -28,7 +28,5 @@
 
 #include "regname.h"
-
-#define INITIAL_STACK        0x80040000
-#define MSIM_DORDER_ADDRESS  0x90000004
+#include "main.h"
 
 .set noat
@@ -41,13 +39,66 @@
 start:
 	
+	/* Setup CPU map (on msim this code
+	   is executed in parallel on all CPUs,
+	   but it not an issue) */
+	la $a0, CPUMAP
+	
+	sw $zero, 0($a0)
+	sw $zero, 4($a0)
+	sw $zero, 8($a0)
+	sw $zero, 12($a0)
+	
+	sw $zero, 16($a0)
+	sw $zero, 20($a0)
+	sw $zero, 24($a0)
+	sw $zero, 28($a0)
+	
+	sw $zero, 32($a0)
+	sw $zero, 36($a0)
+	sw $zero, 40($a0)
+	sw $zero, 44($a0)
+	
+	sw $zero, 48($a0)
+	sw $zero, 52($a0)
+	sw $zero, 56($a0)
+	sw $zero, 60($a0)
+	
+	sw $zero, 64($a0)
+	sw $zero, 68($a0)
+	sw $zero, 72($a0)
+	sw $zero, 76($a0)
+	
+	sw $zero, 80($a0)
+	sw $zero, 84($a0)
+	sw $zero, 88($a0)
+	sw $zero, 92($a0)
+	
+	sw $zero, 96($a0)
+	sw $zero, 100($a0)
+	sw $zero, 104($a0)
+	sw $zero, 108($a0)
+	
+	sw $zero, 112($a0)
+	sw $zero, 116($a0)
+	sw $zero, 120($a0)
+	sw $zero, 124($a0)
+	
+	lui $a1, 1
+	
 #ifdef MACHINE_msim
+	
 	/* Read dorder value */
 	la $k0, MSIM_DORDER_ADDRESS
-	lw $k0, ($k0)
+	lw $k1, ($k0)
 	
 	/* If we are not running on BSP
-	   end in an infinite loop  */
-	beq $k0, $zero, bsp
+	   then end in an infinite loop  */
+	beq $k1, $zero, bsp
 	nop
+	
+	/* Record CPU presence */
+	sll $a2, $k1, 2
+	addu $a2, $a2, $a0
+	sw $a1, ($a2)
 	
 	loop:
@@ -58,7 +109,9 @@
 	
 	bsp:
+		/* Record CPU presence */
+		sw $a1, ($a0)
+		
 		/* Setup initial stack */
-		lui $sp, INITIAL_STACK >> 16
-		ori $sp, $sp, INITIAL_STACK & 0xffff
+		la $sp, INITIAL_STACK
 		
 		j bootstrap
Index: boot/arch/mips32/loader/main.c
===================================================================
--- boot/arch/mips32/loader/main.c	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/mips32/loader/main.c	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -29,4 +29,5 @@
 #include "main.h" 
 #include <printf.h>
+#include <align.h>
 #include <macros.h>
 #include "msim.h"
@@ -74,7 +75,8 @@
 	
 	printf("\nCopying components\n");
+	
 	unsigned int top = 0;
 	bootinfo.cnt = 0;
-	for (i = 0; i < COMPONENTS; i++) {
+	for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
 		printf(" %s...", components[i].name);
 		top = ALIGN_UP(top, PAGE_SIZE);
@@ -89,5 +91,12 @@
 	}
 	
+	unsigned int *cpumap = (unsigned int *) CPUMAP;
+	bootinfo.cpumap = 0;
+	for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
+		if (cpumap[i] != 0)
+			bootinfo.cpumap |= (1 << i);
+	}
+	
 	printf("\nBooting the kernel...\n");
-	jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
+	jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo);
 }
Index: boot/arch/mips32/loader/main.h
===================================================================
--- boot/arch/mips32/loader/main.h	(revision 85156d302a086103852bf03ded648aeb26304afa)
+++ boot/arch/mips32/loader/main.h	(revision 96e0748d7558e9aeb4c97ff5d520f773c406eeac)
@@ -30,12 +30,12 @@
 #define BOOT_mips32_MAIN_H_
 
-/** Align to the nearest higher address.
- *
- * @param addr  Address or size to be aligned.
- * @param align Size of alignment, must be power of 2.
- */
-#define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
+#define CPUMAP               0x80001000
+#define INITIAL_STACK        0x80002000
+#define MSIM_DORDER_ADDRESS  0xb0000004
 
-#define TASKMAP_MAX_RECORDS 32
+#define TASKMAP_MAX_RECORDS  32
+#define CPUMAP_MAX_RECORDS   32
+
+#ifndef __ASM__
 
 typedef struct {
@@ -45,4 +45,5 @@
 
 typedef struct {
+	unsigned int cpumap;
 	unsigned int cnt;
 	task_t tasks[TASKMAP_MAX_RECORDS];
@@ -53,2 +54,4 @@
 
 #endif
+
+#endif
