Index: kernel/arch/ia64/src/interrupt.c
===================================================================
--- kernel/arch/ia64/src/interrupt.c	(revision 9d58539899ea3bf36d74e87b391c0a986e338e26)
+++ kernel/arch/ia64/src/interrupt.c	(revision 416ef4975ca6ca64af9b708856508ad388045f23)
@@ -54,4 +54,5 @@
 #include <synch/spinlock.h>
 #include <mm/tlb.h>
+#include <arch/mm/tlb.h>
 #include <symtab.h>
 #include <putchar.h>
@@ -59,9 +60,7 @@
 #define VECTORS_64_BUNDLE        20
 #define VECTORS_16_BUNDLE        48
-#define VECTORS_16_BUNDLE_START  0x5000
-
-#define VECTOR_MAX  0x7f00
-
-#define BUNDLE_SIZE  16
+#define VECTORS_16_BUNDLE_START  0x50
+
+#define VECTOR_MAX  0x7f
 
 static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
@@ -122,13 +121,12 @@
 };
 
-static const char *vector_to_string(uint16_t vector)
-{
-	ASSERT(vector <= VECTOR_MAX);
-	
-	if (vector >= VECTORS_16_BUNDLE_START)
-		return vector_names_16_bundle[(vector -
-		    VECTORS_16_BUNDLE_START) / (16 * BUNDLE_SIZE)];
+static const char *vector_to_string(unsigned int n)
+{
+	ASSERT(n <= VECTOR_MAX);
+	
+	if (n >= VECTORS_16_BUNDLE_START)
+		return vector_names_16_bundle[n - VECTORS_16_BUNDLE_START];
 	else
-		return vector_names_64_bundle[vector / (64 * BUNDLE_SIZE)];
+		return vector_names_64_bundle[n / 4];
 }
 
@@ -153,5 +151,5 @@
 }
 
-void general_exception(uint64_t vector, istate_t *istate)
+void general_exception(unsigned int n, istate_t *istate)
 {
 	const char *desc;
@@ -182,8 +180,8 @@
 	
 	fault_if_from_uspace(istate, "General Exception (%s).", desc);
-	panic_badtrap(istate, vector, "General Exception (%s).", desc);
-}
-
-void disabled_fp_register(uint64_t vector, istate_t *istate)
+	panic_badtrap(istate, n, "General Exception (%s).", desc);
+}
+
+void disabled_fp_register(unsigned int n, istate_t *istate)
 {
 #ifdef CONFIG_FPU_LAZY
@@ -191,17 +189,15 @@
 #else
 	fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
-	    (uint16_t) vector, vector_to_string(vector));
+	    (uint16_t) n, vector_to_string(n));
 	panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
-	    (uint16_t) vector, vector_to_string(vector));
+	    (uint16_t) n, vector_to_string(n));
 #endif
 }
 
-void nop_handler(uint64_t vector, istate_t *istate)
-{
-}
-
 /** Handle syscall. */
-int break_instruction(uint64_t vector, istate_t *istate)
-{
+sysarg_t break_instruction(unsigned int n, istate_t *istate)
+{
+	sysarg_t ret;
+
 	/*
 	 * Move to next instruction after BREAK.
@@ -214,14 +210,18 @@
 	}
 	
-	return syscall_handler(istate->in0, istate->in1, istate->in2,
+	interrupts_enable();
+	ret = syscall_handler(istate->in0, istate->in1, istate->in2,
 	    istate->in3, istate->in4, istate->in5, istate->in6);
-}
-
-void universal_handler(uint64_t vector, istate_t *istate)
+	interrupts_disable();
+
+	return ret;
+}
+
+void universal_handler(unsigned int n, istate_t *istate)
 {
 	fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
-	    (uint16_t) vector, vector_to_string(vector));
-	panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
-	    (uint16_t) vector, vector_to_string(vector));
+	    n, vector_to_string(n));
+	panic_badtrap(istate, n, "Interruption: %#hx (%s).",
+	    n, vector_to_string(n));
 }
 
@@ -229,9 +229,9 @@
 {
 	asm volatile (
-		"mov cr.eoi=r0;;"
+		"mov cr.eoi = r0 ;;"
 	);
 }
 
-void external_interrupt(uint64_t vector, istate_t *istate)
+void external_interrupt(unsigned int n, istate_t *istate)
 {
 	cr_ivr_t ivr;
@@ -298,4 +298,47 @@
 }
 
+void exception_init(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < IVT_ITEMS; i++)
+		exc_register(i, "universal_handler", false, universal_handler);
+
+	exc_register(EXC_ALT_ITLB_FAULT,
+	    vector_to_string(EXC_ALT_ITLB_FAULT), true,
+	    alternate_instruction_tlb_fault);
+	exc_register(EXC_ALT_DTLB_FAULT,
+	    vector_to_string(EXC_ALT_DTLB_FAULT), true,
+	    alternate_data_tlb_fault);
+	exc_register(EXC_NESTED_TLB_FAULT,
+	    vector_to_string(EXC_NESTED_TLB_FAULT), false,
+	    data_nested_tlb_fault);
+	exc_register(EXC_DATA_D_BIT_FAULT,
+	    vector_to_string(EXC_DATA_D_BIT_FAULT), true,
+	    data_dirty_bit_fault);
+	exc_register(EXC_INST_A_BIT_FAULT,
+	    vector_to_string(EXC_INST_A_BIT_FAULT), true,
+	    instruction_access_bit_fault);
+	exc_register(EXC_DATA_A_BIT_FAULT, 
+	    vector_to_string(EXC_DATA_A_BIT_FAULT), true,
+	    data_access_bit_fault);
+	exc_register(EXC_EXT_INTERRUPT,
+	    vector_to_string(EXC_EXT_INTERRUPT), true,
+	    external_interrupt);
+
+	exc_register(EXC_PAGE_NOT_PRESENT,
+	    vector_to_string(EXC_PAGE_NOT_PRESENT), true,
+	    page_not_present);
+	exc_register(EXC_DATA_AR_FAULT,
+	    vector_to_string(EXC_DATA_AR_FAULT), true,
+	    data_access_rights_fault);
+	exc_register(EXC_GENERAL_EXCEPTION,
+	    vector_to_string(EXC_GENERAL_EXCEPTION), false,
+	    general_exception);
+	exc_register(EXC_DISABLED_FP_REG,
+	    vector_to_string(EXC_DISABLED_FP_REG), true,
+	    disabled_fp_register);
+}
+
 /** @}
  */
