Index: boot/Makefile
===================================================================
--- boot/Makefile	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/Makefile	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -76,5 +76,5 @@
 		cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
 	done
-	
+
 clean: clean_dist
 	$(MAKE) -f $(BUILD) clean PRECHECK=$(PRECHECK)
Index: boot/Makefile.silo
===================================================================
--- boot/Makefile.silo	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/Makefile.silo	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -31,9 +31,5 @@
 include Makefile.common
 
-ifeq ($(CONFIG_AOUT_ISOFS_B),y)
-	SILO_PACKAGE = a.out
-else
-	SILO_PACKAGE = raw
-endif
+SILO_PACKAGE = a.out
 
 ISOFS_B = silo/$(SILO_PACKAGE)/isofs.b
Index: boot/Makefile.uboot
===================================================================
--- boot/Makefile.uboot	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/Makefile.uboot	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -31,6 +31,6 @@
 include Makefile.common
 
-IMAGE_NAME=HelenOS-$(RELEASE)
-BIN_OUTPUT=image.bin
+IMAGE_NAME = HelenOS-$(RELEASE)
+BIN_OUTPUT = image.bin
 
 all: $(POST_OUTPUT)
@@ -40,6 +40,5 @@
 
 $(POST_OUTPUT): $(BIN_OUTPUT)
-	$(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr 0x30008000 -saddr 0x30008000 \
-    $< $@
+	$(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr 0x30008000 -saddr 0x30008000 $< $@
 
 clean:
Index: boot/arch/ia64/include/types.h
===================================================================
--- boot/arch/ia64/include/types.h	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/arch/ia64/include/types.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -30,7 +30,9 @@
 #define BOOT_ia64_TYPES_H_
 
+#include <arch/common.h>
+
 #define TASKMAP_MAX_RECORDS		32
 #define BOOTINFO_TASK_NAME_BUFLEN	32
-#define MEMMAP_ITEMS			128	
+#define MEMMAP_ITEMS			128
 
 typedef uint64_t size_t;
@@ -53,10 +55,10 @@
 	unsigned long base;
 	unsigned long size;
-} efi_memmap_item_t;
+} memmap_item_t;
 
 typedef struct {
 	binit_t taskmap;
 
-	efi_memmap_item_t memmap[MEMMAP_ITEMS];
+	memmap_item_t memmap[MEMMAP_ITEMS];
 	unsigned int memmap_items;
 
@@ -65,6 +67,14 @@
 	unsigned long freq_scale;
 	unsigned int wakeup_intno;
-	int hello_configured;
 } bootinfo_t;
 
+/** This is a minimal ELILO-compatible boot parameter structure. */
+typedef struct {
+	uint64_t cmd_line;
+	uint64_t efi_system_table;
+	uint64_t efi_memmap;
+	uint64_t efi_memmap_sz;
+	uint64_t efi_memdesc_sz;
+} boot_param_t;
+
 #endif
Index: boot/arch/ia64/src/boot.S
===================================================================
--- boot/arch/ia64/src/boot.S	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/arch/ia64/src/boot.S	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -37,4 +37,11 @@
 
 	#
+	# Save the boot parameter structure address passed from the
+	# ELILO-compatible EFI loader.
+	#
+	movl r8 = bootpar ;;
+	st8 [r8] = r28
+
+	#
 	# Initialize the register stack to some sane value.
 	#
@@ -62,4 +69,8 @@
 .bss
 
+.global bootpar
+bootpar:
+	.quad 0
+
 .align STACK_SIZE
 initial_stack:
Index: boot/arch/ia64/src/main.c
===================================================================
--- boot/arch/ia64/src/main.c	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/arch/ia64/src/main.c	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -30,7 +30,9 @@
 
 #include <arch/main.h>
+#include <arch/types.h>
 #include <arch/arch.h>
 #include <arch/asm.h>
 #include <arch/_components.h>
+#include <genarch/efi.h>
 #include <halt.h>
 #include <printf.h>
@@ -51,9 +53,80 @@
 #define DEFAULT_SYS_FREQ		100000000ULL		/* 100MHz */
 
-#define EFI_MEMMAP_FREE_MEM		0
-#define EFI_MEMMAP_IO			1
-#define EFI_MEMMAP_IO_PORTS		2
+#define MEMMAP_FREE_MEM		0
+#define MEMMAP_IO		1
+#define MEMMAP_IO_PORTS		2
+
+extern boot_param_t *bootpar;
 
 static bootinfo_t bootinfo;
+
+static void read_efi_memmap(void)
+{
+	memmap_item_t *memmap = bootinfo.memmap;
+	size_t items = 0;
+	
+	if (!bootpar) {
+		/* Fake-up a memory map for simulators. */
+		memmap[items].base = DEFAULT_MEMORY_BASE;
+		memmap[items].size = DEFAULT_MEMORY_SIZE;
+		memmap[items].type = MEMMAP_FREE_MEM;
+		items++;
+
+		memmap[items].base = DEFAULT_LEGACY_IO_BASE;
+		memmap[items].size = DEFAULT_LEGACY_IO_SIZE;
+		memmap[items].type = MEMMAP_IO_PORTS;
+		items++;		 
+	} else {
+		char *cur, *mm_base = (char *) bootpar->efi_memmap;
+		size_t mm_size = bootpar->efi_memmap_sz;
+		size_t md_size = bootpar->efi_memdesc_sz;
+		
+		/*
+		 * Walk the EFI memory map using the V1 memory descriptor
+		 * format. The actual memory descriptor can use newer format,
+		 * but it must always be backwards compatible with the V1
+		 * format.
+		 */
+		for (cur = mm_base;
+		    (cur < mm_base + (mm_size - md_size)) &&
+		    (items < MEMMAP_ITEMS);
+		    cur += md_size) {
+			efi_v1_memdesc_t *md = (efi_v1_memdesc_t *) cur;
+
+			switch ((efi_memory_type_t) md->type) {
+			case EFI_CONVENTIONAL_MEMORY:
+				memmap[items].type = MEMMAP_FREE_MEM;
+				break;
+			case EFI_MEMORY_MAPPED_IO:
+				memmap[items].type = MEMMAP_IO;
+				break;
+			case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
+				memmap[items].type = MEMMAP_IO_PORTS;
+				break;
+			default:
+				continue;
+			}
+			
+			memmap[items].base = md->phys_start;
+			memmap[items].size = md->pages * EFI_PAGE_SIZE;
+			items++;
+		}
+	}
+	
+	bootinfo.memmap_items = items;
+}
+
+static void read_sal_configuration(void)
+{
+	if (!bootpar) {
+		/* Configure default values for simulators. */
+		bootinfo.freq_scale = DEFAULT_FREQ_SCALE;
+		bootinfo.sys_freq = DEFAULT_SYS_FREQ;
+	} else {
+		/* TODO: read the real values from SAL */
+		bootinfo.freq_scale = DEFAULT_FREQ_SCALE;
+		bootinfo.sys_freq = DEFAULT_SYS_FREQ;
+	}
+}
 
 void bootstrap(void)
@@ -113,31 +186,7 @@
 	
 	printf(".\n");
-	
-	if (!bootinfo.hello_configured) {	/* XXX */
-		/*
-		 * Load configuration defaults for simulators.
-		 */
-		 bootinfo.memmap_items = 0;
-		 
-		 bootinfo.memmap[bootinfo.memmap_items].base =
-		     DEFAULT_MEMORY_BASE;
-		 bootinfo.memmap[bootinfo.memmap_items].size =
-		     DEFAULT_MEMORY_SIZE;
-		 bootinfo.memmap[bootinfo.memmap_items].type =
-		     EFI_MEMMAP_FREE_MEM;
-		 bootinfo.memmap_items++;
 
-		 bootinfo.memmap[bootinfo.memmap_items].base =
-		     DEFAULT_LEGACY_IO_BASE;
-		 bootinfo.memmap[bootinfo.memmap_items].size =
-		     DEFAULT_LEGACY_IO_SIZE;
-		 bootinfo.memmap[bootinfo.memmap_items].type =
-		     EFI_MEMMAP_IO_PORTS;
-		 bootinfo.memmap_items++;
-		 
-		 bootinfo.freq_scale = DEFAULT_FREQ_SCALE;
-		 bootinfo.sys_freq = DEFAULT_SYS_FREQ;
-	}
-	
+	read_efi_memmap();
+	read_sal_configuration();
 	
 	printf("Booting the kernel ...\n");
Index: boot/arch/mips32/Makefile.inc
===================================================================
--- boot/arch/mips32/Makefile.inc	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/arch/mips32/Makefile.inc	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -30,7 +30,5 @@
 BITS = 32
 PAGE_SIZE = 16384
-EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3
-
-RD_SRVS_ESSENTIAL +=
+EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=32
 
 RD_SRVS_NON_ESSENTIAL += \
Index: boot/arch/mips64/Makefile.inc
===================================================================
--- boot/arch/mips64/Makefile.inc	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/Makefile.inc	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2006 Martin Decky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+BFD_ARCH = mips:4000
+BITS = 64
+PAGE_SIZE = 16384
+EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=64
+
+ifeq ($(MACHINE),msim)
+	BFD_NAME = elf64-tradlittlemips
+	BFD_OUTPUT = binary
+	ENDIANESS = LE
+	EXTRA_GCC_CFLAGS = -mhard-float
+endif
+
+SOURCES = \
+	arch/$(BARCH)/src/asm.S \
+	arch/$(BARCH)/src/main.c \
+	arch/$(BARCH)/src/putchar.c \
+	$(COMPS_C) \
+	genarch/src/division.c \
+	genarch/src/multiplication.c \
+	generic/src/memstr.c \
+	generic/src/printf_core.c \
+	generic/src/vprintf.c \
+	generic/src/printf.c \
+	generic/src/str.c \
+	generic/src/version.c \
+	generic/src/inflate.c
Index: boot/arch/mips64/_link.ld.in
===================================================================
--- boot/arch/mips64/_link.ld.in	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/_link.ld.in	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,30 @@
+OUTPUT_FORMAT(elf64-tradlittlemips)
+ENTRY(start)
+
+SECTIONS {
+	. = 0xffffffffbfc00000;
+	.text : {
+		*(BOOTSTRAP);
+		*(.text);
+	}
+	.data : {
+		*(.data);       /* initialized data */
+		*(.rodata);
+		*(.rodata.*);
+		*(.sdata);
+		*(.reginfo);
+		*(.sbss);
+		*(.scommon);
+		*(.bss);        /* uninitialized static variables */
+		*(COMMON);      /* global variables */
+[[COMPONENTS]]
+	}
+	
+	/DISCARD/ : {
+		*(.gnu.*);
+		*(.mdebug*);
+		*(.pdr);
+		*(.comment);
+		*(.note);
+	}
+}
Index: boot/arch/mips64/include/arch.h
===================================================================
--- boot/arch/mips64/include/arch.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/include/arch.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips64_ARCH_H_
+#define BOOT_mips64_ARCH_H_
+
+#define PAGE_WIDTH  14
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define CPUMAP_OFFSET    0x00001000
+#define STACK_OFFSET     0x00002000
+#define BOOTINFO_OFFSET  0x00003000
+#define BOOT_OFFSET      0x00100000
+#define LOADER_OFFSET    0x1fc00000
+
+#define MSIM_VIDEORAM_ADDRESS  0xffffffffb0000000
+#define MSIM_DORDER_ADDRESS    0xffffffffb0000100
+
+#ifndef __ASM__
+	#define PA2KA(addr)    (((uintptr_t) (addr)) + 0xffffffff80000000)
+	#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xffffffffa0000000)
+#else
+	#define PA2KA(addr)    ((addr) + 0xffffffff80000000)
+	#define KSEG2PA(addr)  ((addr) - 0xffffffffa0000000)
+#endif
+
+#endif
Index: boot/arch/mips64/include/asm.h
===================================================================
--- boot/arch/mips64/include/asm.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/include/asm.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,1 @@
+../../mips32/include/asm.h
Index: boot/arch/mips64/include/main.h
===================================================================
--- boot/arch/mips64/include/main.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/include/main.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,1 @@
+../../mips32/include/main.h
Index: boot/arch/mips64/include/regname.h
===================================================================
--- boot/arch/mips64/include/regname.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/include/regname.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,1 @@
+../../mips32/include/regname.h
Index: boot/arch/mips64/include/types.h
===================================================================
--- boot/arch/mips64/include/types.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/include/types.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips64_TYPES_H_
+#define BOOT_mips64_TYPES_H_
+
+#define TASKMAP_MAX_RECORDS        32
+#define CPUMAP_MAX_RECORDS         32
+#define BOOTINFO_TASK_NAME_BUFLEN  32
+
+typedef uint64_t size_t;
+typedef uint64_t uintptr_t;
+
+typedef struct {
+	/** Address where the task was placed. */
+	void *addr;
+	/** Size of the task's binary. */
+	size_t size;
+	/** Task name. */
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} task_t;
+
+typedef struct {
+	uint32_t cpumap;
+	size_t cnt;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} bootinfo_t;
+
+#endif
Index: boot/arch/mips64/src/asm.S
===================================================================
--- boot/arch/mips64/src/asm.S	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/src/asm.S	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,150 @@
+#
+# Copyright (c) 2006 Martin Decky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#include <arch/arch.h>
+#include <arch/regname.h>
+
+.set noat
+.set noreorder
+.set nomacro
+
+.global start
+.global halt
+.global jump_to_kernel
+
+.section BOOTSTRAP
+
+start:
+	/*
+	 * Setup the CP0 configuration
+	 *  - Enable 64-bit kernel addressing mode
+	 *  - Enable 64-bit supervisor adressing mode
+	 *  - Enable 64-bit user addressing mode
+	 */
+	dmfc0 $a0, $status
+	ori $a0, 0x00e0
+	dmtc0 $a0, $status
+	
+	/*
+	 * Setup CPU map (on msim this code
+	 * is executed in parallel on all CPUs,
+	 * but it not an issue).
+	 */
+	dla $a0, PA2KA(CPUMAP_OFFSET)
+	
+	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 */
+	dla $k0, MSIM_DORDER_ADDRESS
+	lw $k1, ($k0)
+	
+	/*
+	 * If we are not running on 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:
+		j loop
+		nop
+	
+#endif
+	
+	bsp:
+		/* Record CPU presence */
+		sw $a1, ($a0)
+		
+		/* Setup initial stack */
+		dla $sp, PA2KA(STACK_OFFSET)
+		
+		j bootstrap
+		nop
+
+.text
+
+halt:
+	j halt
+	nop
+
+jump_to_kernel:
+	/*
+	 * TODO:
+	 *
+	 * Make sure that the I-cache, D-cache and memory are mutually
+	 * coherent before passing control to the copied code.
+	 */
+	j $a0
+	nop
Index: boot/arch/mips64/src/main.c
===================================================================
--- boot/arch/mips64/src/main.c	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/src/main.c	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/main.h>
+#include <arch/arch.h>
+#include <arch/asm.h>
+#include <arch/_components.h>
+#include <halt.h>
+#include <printf.h>
+#include <memstr.h>
+#include <version.h>
+#include <macros.h>
+#include <align.h>
+#include <str.h>
+#include <errno.h>
+#include <inflate.h>
+
+#define TOP2ADDR(top)  (((void *) PA2KA(BOOT_OFFSET)) + (top))
+
+static bootinfo_t *bootinfo = (bootinfo_t *) PA2KA(BOOTINFO_OFFSET);
+static uint32_t *cpumap = (uint32_t *) PA2KA(CPUMAP_OFFSET);
+
+void bootstrap(void)
+{
+	version_print();
+	
+	printf("\nMemory statistics\n");
+	printf(" %p|%p: CPU map\n", (void *) PA2KA(CPUMAP_OFFSET),
+	    (void *) CPUMAP_OFFSET);
+	printf(" %p|%p: bootstrap stack\n", (void *) PA2KA(STACK_OFFSET),
+	    (void *) STACK_OFFSET);
+	printf(" %p|%p: boot info structure\n",
+	    (void *) PA2KA(BOOTINFO_OFFSET), (void *) BOOTINFO_OFFSET);
+	printf(" %p|%p: kernel entry point\n", (void *) PA2KA(BOOT_OFFSET),
+	    (void *) BOOT_OFFSET);
+	printf(" %p|%p: bootloader entry point\n",
+	    (void *) PA2KA(LOADER_OFFSET), (void *) LOADER_OFFSET);
+	
+	size_t i;
+	for (i = 0; i < COMPONENTS; i++)
+		printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
+		    (void *) KSEG2PA(components[i].start), components[i].name,
+		    components[i].inflated, components[i].size);
+	
+	void *dest[COMPONENTS];
+	size_t top = 0;
+	size_t cnt = 0;
+	bootinfo->cnt = 0;
+	for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
+		top = ALIGN_UP(top, PAGE_SIZE);
+		
+		if (i > 0) {
+			bootinfo->tasks[bootinfo->cnt].addr = TOP2ADDR(top);
+			bootinfo->tasks[bootinfo->cnt].size = components[i].inflated;
+			
+			str_cpy(bootinfo->tasks[bootinfo->cnt].name,
+			    BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
+			
+			bootinfo->cnt++;
+		}
+		
+		dest[i] = TOP2ADDR(top);
+		top += components[i].inflated;
+		cnt++;
+	}
+	
+	printf("\nInflating components ... ");
+	
+	for (i = cnt; i > 0; i--) {
+		void *tail = dest[i - 1] + components[i].inflated;
+		if (tail >= ((void *) PA2KA(LOADER_OFFSET))) {
+			printf("\n%s: Image too large to fit (%p >= %p), halting.\n",
+			    components[i].name, tail, (void *) PA2KA(LOADER_OFFSET));
+			halt();
+		}
+		
+		printf("%s ", components[i - 1].name);
+		
+		int err = inflate(components[i - 1].start, components[i - 1].size,
+		    dest[i - 1], components[i - 1].inflated);
+		
+		if (err != EOK) {
+			printf("\n%s: Inflating error %d, halting.\n",
+			    components[i - 1].name, err);
+			halt();
+		}
+	}
+	
+	printf(".\n");
+	
+	printf("Copying CPU map ... \n");
+	
+	bootinfo->cpumap = 0;
+	for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
+		if (cpumap[i] != 0)
+			bootinfo->cpumap |= (1 << i);
+	}
+	
+	printf("Booting the kernel ... \n");
+	jump_to_kernel((void *) PA2KA(BOOT_OFFSET), bootinfo);
+}
Index: boot/arch/mips64/src/putchar.c
===================================================================
--- boot/arch/mips64/src/putchar.c	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/arch/mips64/src/putchar.c	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <typedefs.h>
+#include <arch/arch.h>
+#include <putchar.h>
+#include <str.h>
+
+void putchar(const wchar_t ch)
+{
+	if (ascii_check(ch))
+		*((char *) MSIM_VIDEORAM_ADDRESS) = ch;
+	else
+		*((char *) MSIM_VIDEORAM_ADDRESS) = U_SPECIAL;
+}
Index: boot/arch/sparc64/Makefile.inc
===================================================================
--- boot/arch/sparc64/Makefile.inc	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/arch/sparc64/Makefile.inc	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -43,5 +43,4 @@
 
 RD_SRVS_ESSENTIAL += \
-	$(USPACE_PATH)/srv/hw/irc/fhc/fhc \
 	$(USPACE_PATH)/srv/hw/irc/obio/obio
 
Index: boot/arch/sparc64/src/main.c
===================================================================
--- boot/arch/sparc64/src/main.c	(revision f5b25224f3b95c0a700f5f9f6c8bb2ecad2c28f0)
+++ boot/arch/sparc64/src/main.c	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -182,8 +182,5 @@
 	 * of the "/memory" node to find out which parts of memory
 	 * are used by OBP and redesign the algorithm of copying
-	 * kernel/init tasks/ramdisk from the bootable image to memory
-	 * (which we must do anyway because of issues with claiming the memory
-	 * on Serengeti).
-	 *
+	 * kernel/init tasks/ramdisk from the bootable image to memory.
 	 */
 	bootinfo.physmem_start += OBP_BIAS;
Index: boot/genarch/include/efi.h
===================================================================
--- boot/genarch/include/efi.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
+++ boot/genarch/include/efi.h	(revision 1916d1fd1c0feafd9e0421a202df554bc05db806)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2011 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_EFI_H_
+#define BOOT_EFI_H_
+
+typedef enum {
+	EFI_RESERVED,
+	EFI_LOADER_CODE,
+	EFI_LOADER_DATA,
+	EFI_BOOT_SERVICES_CODE,
+	EFI_BOOT_SERVICES_DATA,
+	EFI_RUNTIME_SERVICES_CODE,
+	EFI_RUNTIME_SERVICES_DATA,
+	EFI_CONVENTIONAL_MEMORY,
+	EFI_UNUSABLE_MEMORY,
+	EFI_ACPI_RECLAIM_MEMORY,
+	EFI_ACPI_MEMORY_NVS,
+	EFI_MEMORY_MAPPED_IO,
+	EFI_MEMORY_MAPPED_IO_PORT_SPACE,
+	EFI_PAL_CODE
+} efi_memory_type_t;
+
+typedef struct {
+	uint32_t type;
+	uint64_t phys_start;
+	uint64_t virt_start;
+	uint64_t pages;
+	uint64_t attribute;
+} efi_v1_memdesc_t;
+
+#define EFI_PAGE_SIZE	4096
+
+#endif
