Index: boot/arch/ia64/Makefile.inc
===================================================================
--- boot/arch/ia64/Makefile.inc	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/Makefile.inc	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,60 @@
+#
+# 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_NAME = elf64-ia64-little
+BFD_OUTPUT = $(BFD_NAME)
+BFD_ARCH = ia64
+
+BITS = 64
+ENDIANESS = LE
+PAGE_SIZE = 16384
+EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic
+
+RD_SRVS_NON_ESSENTIAL +=
+
+RD_SRVS_ESSENTIAL +=
+
+SOURCES = \
+	arch/$(BARCH)/src/boot.S \
+	arch/$(BARCH)/src/asm.S \
+	arch/$(BARCH)/src/main.c \
+	arch/$(BARCH)/src/putchar.c \
+	$(COMPS_C) \
+	genarch/src/division.c \
+	generic/src/balloc.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
+
+ifeq ($(MACHINE),ski)
+SOURCES += \
+	arch/$(BARCH)/src/ski.c
+endif
Index: boot/arch/ia64/_link.ld
===================================================================
--- boot/arch/ia64/_link.ld	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/_link.ld	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,33 @@
+OUTPUT_FORMAT("elf64-ia64-little")
+ENTRY(start)
+
+SECTIONS {
+	.boot 0x4400000: AT (0x4400000) {
+		*(BOOTSTRAP);
+		*(.text);
+		*(.sdata);
+		*(.sdata2);
+		*(.sbss);
+		*(.rodata);
+		*(.rodata.*);
+		*(.data);               /* initialized data */
+		_got = . ;
+		*(.got .got.*);
+		*(.bss);                /* uninitialized static variables */
+		*(COMMON);
+		*(.kernel_image);
+		*(.ns_image);
+		*(.loader_image);
+		*(.init_image);
+		*(.devmap_image);
+		*(.rd_image);
+		*(.vfs_image);
+		*(.fat_image);
+		*(.initrd_image);
+	}
+
+	/DISCARD/ : {
+		*(.comment);
+		*(.note*);
+	}
+}
Index: boot/arch/ia64/_link.ld.in
===================================================================
--- boot/arch/ia64/_link.ld.in	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/_link.ld.in	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,25 @@
+OUTPUT_FORMAT("elf64-ia64-little")
+ENTRY(start)
+
+SECTIONS {
+	.boot 0x4400000: AT (0x4400000) {
+		*(BOOTSTRAP);
+		*(.text);
+		*(.sdata);
+		*(.sdata2);
+		*(.sbss);
+		*(.rodata);
+		*(.rodata.*);
+		*(.data);               /* initialized data */
+		_got = . ;
+		*(.got .got.*);
+		*(.bss);                /* uninitialized static variables */
+		*(COMMON);
+[[COMPONENTS]]
+	}
+
+	/DISCARD/ : {
+		*(.comment);
+		*(.note*);
+	}
+}
Index: boot/arch/ia64/include/_components.h
===================================================================
--- boot/arch/ia64/include/_components.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/_components.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,48 @@
+/***************************************
+ * AUTO-GENERATED FILE, DO NOT EDIT!!! *
+ ***************************************/
+
+#ifndef BOOT_COMPONENTS_H_
+#define BOOT_COMPONENTS_H_
+
+#include <typedefs.h>
+
+#define COMPONENTS  9
+
+typedef struct {
+	const char *name;
+	void *start;
+	size_t size;
+	size_t inflated;
+} component_t;
+
+extern component_t components[];
+
+extern int _binary_kernel_bin_start;
+extern int _binary_kernel_bin_size;
+
+extern int _binary_ns_start;
+extern int _binary_ns_size;
+
+extern int _binary_loader_start;
+extern int _binary_loader_size;
+
+extern int _binary_init_start;
+extern int _binary_init_size;
+
+extern int _binary_devmap_start;
+extern int _binary_devmap_size;
+
+extern int _binary_rd_start;
+extern int _binary_rd_size;
+
+extern int _binary_vfs_start;
+extern int _binary_vfs_size;
+
+extern int _binary_fat_start;
+extern int _binary_fat_size;
+
+extern int _binary_initrd_img_start;
+extern int _binary_initrd_img_size;
+
+#endif
Index: boot/arch/ia64/include/arch.h
===================================================================
--- boot/arch/ia64/include/arch.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/arch.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2006 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_ia64_ARCH_H_
+#define BOOT_ia64_ARCH_H_
+
+#define PAGE_WIDTH  14
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define LOADER_ADDRESS  0x4400000
+#define KERNEL_ADDRESS  0x4404000
+
+#define STACK_SIZE                   8192
+#define STACK_ALIGNMENT              16
+
+#endif
Index: boot/arch/ia64/include/asm.h
===================================================================
--- boot/arch/ia64/include/asm.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/asm.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2006 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_ia64_ASM_H_
+#define BOOT_ia64_ASM_H_
+
+extern void jump_to_kernel(void *) __attribute__((noreturn));
+
+#endif
Index: boot/arch/ia64/include/common.h
===================================================================
--- boot/arch/ia64/include/common.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/common.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,1 @@
+../../../../common.h
Index: boot/arch/ia64/include/main.h
===================================================================
--- boot/arch/ia64/include/main.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/main.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+#ifndef BOOT_ia64_MAIN_H_
+#define BOOT_ia64_MAIN_H_
+
+extern void bootstrap(void);
+
+#endif
Index: boot/arch/ia64/include/ski.h
===================================================================
--- boot/arch/ia64/include/ski.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/ski.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2005 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_ia64_SKI_H_
+#define BOOT_ia64_SKI_H_
+
+#include <str.h>
+
+extern void ski_putchar(const wchar_t);
+
+#endif
Index: boot/arch/ia64/include/types.h
===================================================================
--- boot/arch/ia64/include/types.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/include/types.h	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+#ifndef BOOT_ia64_TYPES_H_
+#define BOOT_ia64_TYPES_H_
+
+#define TASKMAP_MAX_RECORDS		32
+#define BOOTINFO_TASK_NAME_BUFLEN	32
+#define MEMMAP_ITEMS			128	
+
+typedef uint64_t size_t;
+typedef uint64_t unative_t;
+typedef uint64_t uintptr_t;
+
+typedef struct {
+	void *addr;
+	size_t size;
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} binit_task_t;
+
+typedef struct {
+	size_t cnt;
+	binit_task_t tasks[TASKMAP_MAX_RECORDS];
+} binit_t;
+
+typedef struct {
+	unsigned int type;
+	unsigned long base;
+	unsigned long size;
+} efi_memmap_item_t;
+
+typedef struct {
+	binit_t taskmap;
+
+	efi_memmap_item_t memmap[MEMMAP_ITEMS];
+	unsigned int memmap_items;
+
+	unative_t *sapic;
+	unsigned long sys_freq;
+	unsigned long freq_scale;
+	unsigned int wakeup_intno;
+	int hello_configured;
+} bootinfo_t;
+
+#endif
Index: boot/arch/ia64/src/_components.c
===================================================================
--- boot/arch/ia64/src/_components.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/src/_components.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,63 @@
+/***************************************
+ * AUTO-GENERATED FILE, DO NOT EDIT!!! *
+ ***************************************/
+
+#include <typedefs.h>
+#include <arch/_components.h>
+
+component_t components[] = {
+	{
+		.name = "kernel",
+		.start = (void *) &_binary_kernel_bin_start,
+		.size = (size_t) &_binary_kernel_bin_size,
+		.inflated = 971232
+	},
+	{
+		.name = "ns",
+		.start = (void *) &_binary_ns_start,
+		.size = (size_t) &_binary_ns_size,
+		.inflated = 191099
+	},
+	{
+		.name = "loader",
+		.start = (void *) &_binary_loader_start,
+		.size = (size_t) &_binary_loader_size,
+		.inflated = 183300
+	},
+	{
+		.name = "init",
+		.start = (void *) &_binary_init_start,
+		.size = (size_t) &_binary_init_size,
+		.inflated = 184627
+	},
+	{
+		.name = "devmap",
+		.start = (void *) &_binary_devmap_start,
+		.size = (size_t) &_binary_devmap_size,
+		.inflated = 202339
+	},
+	{
+		.name = "rd",
+		.start = (void *) &_binary_rd_start,
+		.size = (size_t) &_binary_rd_size,
+		.inflated = 189439
+	},
+	{
+		.name = "vfs",
+		.start = (void *) &_binary_vfs_start,
+		.size = (size_t) &_binary_vfs_size,
+		.inflated = 222120
+	},
+	{
+		.name = "fat",
+		.start = (void *) &_binary_fat_start,
+		.size = (size_t) &_binary_fat_size,
+		.inflated = 282922
+	},
+	{
+		.name = "initrd",
+		.start = (void *) &_binary_initrd_img_start,
+		.size = (size_t) &_binary_initrd_img_size,
+		.inflated = 9912320
+	}
+};
Index: boot/arch/ia64/src/asm.S
===================================================================
--- boot/arch/ia64/src/asm.S	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/src/asm.S	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,118 @@
+#
+# Copyright (c) 2006 Martin Decky
+# Copyright (c) 2006 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.
+#
+
+#include <arch/arch.h>
+
+.text
+
+.global halt
+.global memcpy
+.global jump_to_kernel
+
+halt:
+	br halt
+
+memcpy:
+	alloc loc0 = ar.pfs, 3, 1, 0, 0
+
+	adds r14 = 7, in1
+	mov r2 = ar.lc
+	mov r8 = in0 ;;
+	and r14 = -8, r14 ;;
+	cmp.ne p6, p7 = r14, in1
+(p7)	br.cond.dpnt 3f ;;
+0:
+	cmp.ne p6, p7 = 0, in2
+(p7)	br.cond.dpnt 2f ;;
+(p6)	adds r14 = -1, in2
+(p6)	mov r16 = r0
+(p6)	mov r17 = r0 ;;
+(p6)	mov ar.lc = r14
+1:
+	add r14 = r16, in1 
+	add r15 = r16, in0
+	adds r17 = 1, r17 ;;
+	ld1 r14 = [r14]
+	mov r16 = r17 ;;
+	st1 [r15] = r14
+	br.cloop.sptk.few 1b ;;
+2:
+	mov ar.lc = r2
+	mov ar.pfs = loc0
+	br.ret.sptk.many rp
+3:
+	adds r14 = 7, in0 ;;
+	and r14 = -8, r14 ;;
+	cmp.eq p6, p7 = r14, in0
+(p7)	br.cond.dptk 0b
+	shr.u r18 = in2, 3 ;;
+	cmp.ne p6, p7 = 0, r18
+(p7)	br.cond.dpnt 5f	;;
+(p6)	adds r14 = -1, r18
+(p6)	mov r16 = r0
+(p6)	mov r17 = r0 ;;
+(p6)	mov ar.lc = r14
+4:
+	shladd r14 = r16, 3, r0
+	adds r16 = 1, r17 ;;
+	add r15 = in1, r14
+	add r14 = in0, r14
+	mov r17 = r16 ;;
+	ld8 r15 = [r15] ;;
+	st8 [r14] = r15
+	br.cloop.sptk.few 4b
+5:
+	and r15 = 7, in2
+	shladd r14 = r18, 3, r0
+	mov r16 = r0
+	mov r18 = r0 ;;
+	cmp.eq p6, p7 = 0, r15
+	add in0 = r14, in0
+	adds r15 = -1, r15
+	add r17 = r14, in1 
+(p6)	br.cond.dpnt 2b	;;
+	mov ar.lc = r15
+6:
+	add r14 = r16, r17
+	add r15 = r16, in0
+	adds r16 = 1, r18 ;;
+	ld1 r14 = [r14]
+	mov r18 = r16 ;;
+	st1 [r15] = r14
+	br.cloop.sptk.few 6b ;;
+	mov ar.lc = r2
+	mov ar.pfs = loc0
+	br.ret.sptk.many rp
+
+jump_to_kernel:
+    alloc loc0 = ar.pfs, 1, 1, 0, 0
+    mov r1 = in0;			# Pass bootinfo address
+    movl r8 = KERNEL_ADDRESS;;
+    mov b1 = r8 ;;
+    br.call.sptk.many b0 = b1;;
Index: boot/arch/ia64/src/boot.S
===================================================================
--- boot/arch/ia64/src/boot.S	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/src/boot.S	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2006 Martin Decky
+# Copyright (c) 2006 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.
+#
+
+#include <arch/arch.h>
+
+.section BOOTSTRAP, "ax"
+
+.global start
+start:
+	movl gp = LOADER_ADDRESS
+
+	#
+	# Initialize the register stack to some sane value.
+	#
+	mov ar.rsc = r0
+	movl r8 = initial_stack ;;
+	mov ar.bspstore = r8
+	loadrs
+
+	#
+	# Initialize memory stack to some sane value and allocate a scratch area
+	# on it.
+	#
+	movl r12 = initial_stack_top ;;
+	add r12 = -16, r12
+
+	ssm (1 << 19) ;;	/* disable f32 - f127 */
+	srlz.i
+	srlz.d ;;
+
+	movl r18 = bootstrap ;;
+	mov b1 = r18 ;;
+	br.call.sptk.many b0 = b1
+
+.bss
+
+.align STACK_SIZE
+initial_stack:
+	.space STACK_SIZE
+initial_stack_top:
Index: boot/arch/ia64/src/main.c
===================================================================
--- boot/arch/ia64/src/main.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/src/main.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * Copyright (c) 2006 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.
+ */
+
+
+#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 DEFAULT_MEMORY_BASE		0x4000000ULL
+#define DEFAULT_MEMORY_SIZE		0x4000000ULL
+#define DEFAULT_LEGACY_IO_BASE		0x00000FFFFC000000ULL
+#define DEFAULT_LEGACY_IO_SIZE		0x4000000ULL
+
+#define DEFAULT_FREQ_SCALE		0x0000000100000001ULL	/* 1/1 */
+#define DEFAULT_SYS_FREQ		100000000ULL		/* 100MHz */
+
+#define EFI_MEMMAP_FREE_MEM		0
+#define EFI_MEMMAP_IO			1
+#define EFI_MEMMAP_IO_PORTS		2
+
+#define BALLOC_MAX_SIZE  131072
+
+#define TOP2ADDR(top)  (((void *) KERNEL_ADDRESS) + (top))
+
+static bootinfo_t bootinfo;
+
+void bootstrap(void)
+{
+	version_print();
+	
+	printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo);
+	printf(" %p|%p: kernel entry point\n", KERNEL_ADDRESS, KERNEL_ADDRESS);
+	printf(" %p|%p: loader entry point\n", LOADER_ADDRESS, KERNEL_ADDRESS);
+	
+	size_t i;
+	for (i = 0; i < COMPONENTS; i++)
+		printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
+		    components[i].start, components[i].name,
+		    components[i].inflated, components[i].size);
+	
+	void *dest[COMPONENTS];
+	size_t top = KERNEL_ADDRESS;
+	size_t cnt = 0;
+	bootinfo.taskmap.cnt = 0;
+	for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
+		top = ALIGN_UP(top, PAGE_SIZE);
+		
+		if (i > 0) {
+			bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
+			    (void *) top;
+			bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
+			    components[i].inflated;
+			
+			str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
+			    BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
+			
+			bootinfo.taskmap.cnt++;
+		}
+		
+		dest[i] = (void *) top;
+		top += components[i].inflated;
+		cnt++;
+	}
+	
+	printf("\nInflating components ... ");
+	
+	for (i = cnt; i > 0; i--) {
+		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");
+	
+	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;
+	}
+	
+	
+	printf("Booting the kernel ...\n");
+	jump_to_kernel(&bootinfo);
+}
Index: boot/arch/ia64/src/putchar.c
===================================================================
--- boot/arch/ia64/src/putchar.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/src/putchar.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,43 @@
+/*
+ * 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>
+#include <arch/ski.h>
+
+void putchar(const wchar_t ch)
+{
+#ifdef MACHINE_ski
+	if (ascii_check(ch))
+		ski_putchar(ch);
+	else
+		ski_putchar(U_SPECIAL);
+#endif
+}
Index: boot/arch/ia64/src/ski.c
===================================================================
--- boot/arch/ia64/src/ski.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
+++ boot/arch/ia64/src/ski.c	(revision 807102ca92b8bf938835cd4c70cfca021daf7c13)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2005 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.
+ */
+
+#include <arch/ski.h>
+#include <typedefs.h>
+
+#define SKI_INIT_CONSOLE	20
+#define	SKI_PUTCHAR		31
+
+static void ski_console_init(void)
+{
+	static bool initialized = false;
+	
+	if (initialized)
+		return;
+
+	asm volatile (
+		"mov r15 = %[cmd]\n"
+		"break 0x80000\n"
+		:
+		: [cmd] "i" (SKI_INIT_CONSOLE)
+		: "r15", "r8"
+	);
+	
+	initialized = true;
+}
+
+void ski_putchar(const wchar_t ch)
+{
+	ski_console_init();
+
+	if (ch == '\n')
+		ski_putchar('\r');
+
+	asm volatile (
+		"mov r15 = %[cmd]\n"
+		"mov r32 = %[ch]\n"   /* r32 is in0 */
+		"break 0x80000\n"     /* modifies r8 */
+		:
+		: [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch)
+		: "r15", "in0", "r8"
+	);
+}
