Index: kernel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision dfe9e2c6efbaee346e82beee24c5d11d7e7cec6d)
+++ kernel/arch/ia64/Makefile.inc	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -43,5 +43,7 @@
 AFLAGS += -mconstant-gp
 
-DEFS += -D__64_BITS__ -DINIT0_ADDRESS=$(INIT0_ADDRESS) -DINIT0_SIZE=$(INIT0_SIZE)
+DEFS += -D__64_BITS__ -DINIT0_ADDRESS=$(INIT0_ADDRESS) -DINIT0_SIZE=$(INIT0_SIZE) -D$(MACHINE)
+
+
 
 ## Compile with page hash table support.
@@ -70,5 +72,4 @@
 	arch/$(ARCH)/src/fpu_context.c \
 	arch/$(ARCH)/src/context.S \
-	arch/$(ARCH)/src/ski/ski.c \
 	arch/$(ARCH)/src/cpu/cpu.c \
 	arch/$(ARCH)/src/ivt.S \
@@ -82,2 +83,13 @@
 	arch/$(ARCH)/src/ddi/ddi.c \
 	arch/$(ARCH)/src/drivers/it.c
+
+ifeq ($(MACHINE),ski)
+	ARCH_SOURCES += arch/$(ARCH)/src/ski/ski.c 
+	DEFS += -DSKI
+endif
+
+ifeq ($(MACHINE),i460GX)
+	ARCH_SOURCES += arch/$(ARCH)/src/simics/ega.c
+	DEFS += -DI460GX
+endif
+
Index: kernel/arch/ia64/include/interrupt.h
===================================================================
--- kernel/arch/ia64/include/interrupt.h	(revision dfe9e2c6efbaee346e82beee24c5d11d7e7cec6d)
+++ kernel/arch/ia64/include/interrupt.h	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -52,5 +52,5 @@
 
 /** External Interrupt vectors. */
-#define INTERRUPT_TIMER		0
+#define INTERRUPT_TIMER		255
 #define INTERRUPT_SPURIOUS	15
 
Index: kernel/arch/ia64/include/simics/ega.h
===================================================================
--- kernel/arch/ia64/include/simics/ega.h	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
+++ kernel/arch/ia64/include/simics/ega.h	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * 2007 Jakub Vana 
+ * 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.
+ */
+
+/** @addtogroup ia32	
+ * @{
+ */
+/** @file
+ */
+
+#ifndef simics_ega_h
+#define simics_ega_h
+
+#define VIDEORAM (0xE0000000000B8000LL)
+
+#define ROW		80
+#define ROWS		25
+#define SCREEN		(ROW * ROWS)
+
+extern void ega_init(void);
+
+#endif
+
+/** @}
+ */
+
Index: kernel/arch/ia64/src/ia64.c
===================================================================
--- kernel/arch/ia64/src/ia64.c	(revision dfe9e2c6efbaee346e82beee24c5d11d7e7cec6d)
+++ kernel/arch/ia64/src/ia64.c	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -51,4 +51,5 @@
 #include <syscall/syscall.h>
 #include <ddi/irq.h>
+#include <arch/simics/ega.h>
 
 void arch_pre_main(void)
@@ -82,8 +83,14 @@
 }
 
+
+
 void arch_post_mm_init(void)
 {
 	irq_init(INR_COUNT, INR_COUNT);
+#ifdef SKI
 	ski_init_console();
+#else	
+	ega_init();
+#endif	
 	it_init();	
 }
@@ -99,5 +106,4 @@
 void arch_post_smp_init(void)
 {
-	thread_t *t;
 
 	if (config.cpu_active == 1) {
@@ -105,8 +111,11 @@
 		 * Create thread that polls keyboard.
 		 */
-		t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll");
+#ifdef SKI
+		thread_t *t;
+		t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
 		if (!t)
 			panic("cannot create kkbdpoll\n");
 		thread_ready(t);
+#endif		
 	}
 }
@@ -156,5 +165,7 @@
 void arch_grab_console(void)
 {
+#ifdef SKI
 	ski_kbd_grab();
+#endif	
 }
 /** Return console to userspace
@@ -163,5 +174,7 @@
 void arch_release_console(void)
 {
+#ifdef SKI
 	ski_kbd_release();
+#endif
 }
 
Index: kernel/arch/ia64/src/simics/ega.c
===================================================================
--- kernel/arch/ia64/src/simics/ega.c	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
+++ kernel/arch/ia64/src/simics/ega.c	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2001-2004 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.
+ */
+
+/** @addtogroup ia32	
+ * @{
+ */
+/**
+ * @file
+ * @brief EGA driver.
+ */
+
+#include <putchar.h>
+#include <mm/page.h>
+#include <mm/as.h>
+#include <arch/mm/page.h>
+#include <synch/spinlock.h>
+#include <arch/types.h>
+#include <arch/asm.h>
+#include <memstr.h>
+#include <console/chardev.h>
+#include <console/console.h>
+#include <sysinfo/sysinfo.h>
+#include <arch/simics/ega.h>
+
+/*
+ * The EGA driver.
+ * Simple and short. Function for displaying characters and "scrolling".
+ */
+
+SPINLOCK_INITIALIZE(egalock);
+static uint32_t ega_cursor;
+static uint8_t *videoram;
+
+static void ega_putchar(chardev_t *d, const char ch);
+
+chardev_t ega_console;
+static chardev_operations_t ega_ops = {
+	.write = ega_putchar
+};
+
+
+void ega_init(void)
+{
+	
+	videoram = (uint8_t *) (VIDEORAM);
+
+	chardev_initialize("ega_out", &ega_console, &ega_ops);
+	stdout = &ega_console;
+	
+	sysinfo_set_item_val("fb", NULL, true);
+	sysinfo_set_item_val("fb.kind", NULL, 2);
+	sysinfo_set_item_val("fb.width", NULL, ROW);
+	sysinfo_set_item_val("fb.height", NULL, ROWS);
+	sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM);
+	
+#ifndef CONFIG_FB
+	putchar('\n');
+#endif	
+}
+
+static void ega_display_char(char ch)
+{
+	videoram[ega_cursor * 2] = ch;
+	videoram[ega_cursor * 2+1] = 7;
+}
+
+/*
+ * This function takes care of scrolling.
+ */
+static void ega_check_cursor(void)
+{
+	int i;
+	if (ega_cursor < SCREEN)
+		return;
+
+	memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2);
+	for(i=0;i<ROW*2;i+=2)
+	{
+		videoram[(SCREEN-ROW)*2+i+0]=0x20;
+		videoram[(SCREEN-ROW)*2+i+1]=0x07;
+	}
+	ega_cursor = ega_cursor - ROW;
+}
+
+void ega_putchar(chardev_t *d, const char ch)
+{
+	ipl_t ipl;
+
+	ipl = interrupts_disable();
+	spinlock_lock(&egalock);
+
+	switch (ch) {
+		case '\n':
+			ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW;
+			break;
+		case '\t':
+			ega_cursor = (ega_cursor + 8) - ega_cursor % 8;
+			break; 
+		case '\b':
+			if (ega_cursor % ROW)
+				ega_cursor--;
+			break;
+		default:
+			ega_display_char(ch);
+			ega_cursor++;
+			break;
+	}
+	ega_check_cursor();
+
+	spinlock_unlock(&egalock);
+	interrupts_restore(ipl);
+}
+
+
+/** @}
+ */
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision dfe9e2c6efbaee346e82beee24c5d11d7e7cec6d)
+++ kernel/generic/src/ipc/irq.c	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -106,5 +106,5 @@
 			break;
 #endif
-#if defined(ia64) 
+#if defined(ia64) && defined(SKI)
 		case CMD_IA64_GETCHAR:
 			dstval = _getc(&ski_uconsole);
Index: kernel/kernel.config
===================================================================
--- kernel/kernel.config	(revision dfe9e2c6efbaee346e82beee24c5d11d7e7cec6d)
+++ kernel/kernel.config	(revision 49319acaa805c75ddb5bb087f767d7b9589f91ce)
@@ -36,4 +36,10 @@
 @ "indy" SGI Indy
 ! [ARCH=mips32] MACHINE (choice)
+
+# Machine type
+@ "ski" Ski ia64 simulator
+@ "i460GX" i460GX chipset machine (include Simics)
+! [ARCH=ia64] MACHINE (choice)
+
 
 # Framebuffer support
