Index: arch/amd64/include/context.h
===================================================================
--- arch/amd64/include/context.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/amd64/include/context.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -59,24 +59,3 @@
 } __attribute__ ((packed));
 
-/** This is passed to interrupt handlers */
-struct interrupt_context {
-	__u64 rax;
-	__u64 rbx;
-	__u64 rcx;
-	__u64 rdx;
-	__u64 rsi;
-	__u64 rdi;
-	__u64 r8;
-	__u64 r9;
-	__u64 r10;
-	__u64 r11;
-	__u64 r12;
-	__u64 r13;
-	__u64 r14;
-	__u64 r15;
-	/* These 2 items MUST be last parts of the structure */
-	__u64 rbp; 
-	__u64 stack[0]; /* Additional data on stack */
-} __attribute__ ((packed));
-
 #endif
Index: arch/amd64/include/interrupt.h
===================================================================
--- arch/amd64/include/interrupt.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/amd64/include/interrupt.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -61,15 +61,36 @@
 #define VECTOR_WAKEUP_IPI		(IVT_FREEBASE+1)
 
+/** This is passed to interrupt handlers */
+struct istate {
+	__u64 rax;
+	__u64 rbx;
+	__u64 rcx;
+	__u64 rdx;
+	__u64 rsi;
+	__u64 rdi;
+	__u64 r8;
+	__u64 r9;
+	__u64 r10;
+	__u64 r11;
+	__u64 r12;
+	__u64 r13;
+	__u64 r14;
+	__u64 r15;
+	/* These 2 items MUST be last parts of the structure */
+	__u64 rbp;
+	__u64 stack[0]; /* Additional data on stack */
+} __attribute__ ((packed));
+
 extern void (* disable_irqs_function)(__u16 irqmask);
 extern void (* enable_irqs_function)(__u16 irqmask);
 extern void (* eoi_function)(void);
 
-extern void null_interrupt(int n, struct interrupt_context *ctx);
-extern void gp_fault(int n, void *stack);
-extern void nm_fault(int n, void *stack);
-extern void ss_fault(int n, void *stack);
-extern void page_fault(int n, struct interrupt_context *ctx);
-extern void syscall(int n, void *stack);
-extern void tlb_shootdown_ipi(int n, void *stack);
+extern void null_interrupt(int n, istate_t *istate);
+extern void gp_fault(int n, istate_t *istate);
+extern void nm_fault(int n, istate_t *istate);
+extern void ss_fault(int n, istate_t *istate);
+extern void page_fault(int n, istate_t *istate);
+extern void syscall(int n, istate_t *istate);
+extern void tlb_shootdown_ipi(int n, istate_t *istate);
 
 extern void trap_virtual_enable_irqs(__u16 irqmask);
Index: arch/amd64/src/interrupt.c
===================================================================
--- arch/amd64/src/interrupt.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/amd64/src/interrupt.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -43,25 +43,8 @@
 #include <proc/thread.h>
 
-/*
-static void messy_stack_trace(__native *stack)
-{
-	__native *upper_limit = (__native *)(((__native)get_stack_base()) + STACK_SIZE);
-	char *symbol;
-
-	printf("Stack contents: ");
-	while (stack < upper_limit) {
-		symbol = get_symtab_entry((__address)*stack);
-		if (symbol)
-			printf("%s, ", symbol);
-		stack++;
-	}
-	printf("\n");
-}
-*/
-
-static void print_info_errcode(int n, struct interrupt_context *ctx)
+static void print_info_errcode(int n, istate_t *istate)
 {
 	char *symbol;
-	__u64 *x = &ctx->stack[0];
+	__u64 *x = &istate->stack[0];
 
 	if (!(symbol=get_symtab_entry(x[1])))
@@ -69,19 +52,18 @@
 
 	printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__);
-	printf("%%rip: %Q (%s)\n",ctx->stack[1],symbol);
-	printf("ERROR_WORD=%Q\n", ctx->stack[0]);
-	printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", ctx->stack[2], 
-	       ctx->stack[3],read_cr0());
-	printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",ctx->rax,ctx->rbx,ctx->rcx);
-	printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",ctx->rdx,ctx->rsi,ctx->rdi);
-	printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",ctx->r8,ctx->r9,ctx->r10);
-	printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",ctx->r11,ctx->r12,ctx->r13);
-	printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",ctx->r14,ctx->r15,&ctx->stack[0]);
-	printf("%%rbp=%Q\n",ctx->rbp);
+	printf("%%rip: %Q (%s)\n",istate->stack[1],symbol);
+	printf("ERROR_WORD=%Q\n", istate->stack[0]);
+	printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", istate->stack[2], 
+	       istate->stack[3],read_cr0());
+	printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",istate->rax,istate->rbx,istate->rcx);
+	printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",istate->rdx,istate->rsi,istate->rdi);
+	printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",istate->r8,istate->r9,istate->r10);
+	printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",istate->r11,istate->r12,istate->r13);
+	printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",istate->r14,istate->r15,&istate->stack[0]);
+	printf("%%rbp=%Q\n",istate->rbp);
 	printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]);
 	printf("       %Q, %Q, %Q\n", x[8], x[9], x[10]);
 	printf("       %Q, %Q, %Q\n", x[11], x[12], x[13]);
 	printf("       %Q, %Q, %Q\n", x[14], x[15], x[16]);
-//	messy_stack_trace(&x[5]);
 }
 
@@ -94,26 +76,26 @@
 void (* eoi_function)(void) = NULL;
 
-void null_interrupt(int n, struct interrupt_context *ctx)
+void null_interrupt(int n, istate_t *istate)
 {
 	printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
-	printf("stack: %X, %X, %X, %X\n", ctx->stack[0], ctx->stack[1],
-	       ctx->stack[2], ctx->stack[3]);
+	printf("stack: %X, %X, %X, %X\n", istate->stack[0], istate->stack[1],
+	       istate->stack[2], istate->stack[3]);
 	panic("unserviced interrupt\n");
 }
 
-void gp_fault(int n, void *stack)
+void gp_fault(int n, istate_t *istate)
 {
-	print_info_errcode(n,stack);
+	print_info_errcode(n, istate);
 	panic("general protection fault\n");
 }
 
-void ss_fault(int n, void *stack)
+void ss_fault(int n, istate_t *istate)
 {
-	print_info_errcode(n,stack);
+	print_info_errcode(n, istate);
 	panic("stack fault\n");
 }
 
 
-void nm_fault(int n, void *stack)
+void nm_fault(int n, istate_t *istate)
 {
 #ifdef CONFIG_FPU_LAZY     
@@ -124,5 +106,5 @@
 }
 
-void page_fault(int n, struct interrupt_context *ctx)
+void page_fault(int n, istate_t *istate)
 {
 	__address page;
@@ -130,5 +112,5 @@
 	page = read_cr2();
 	if (!as_page_fault(page)) {
-		print_info_errcode(n,ctx);
+		print_info_errcode(n, istate);
 		printf("Page fault address: %Q\n", page);
 		panic("page fault\n");
@@ -136,5 +118,5 @@
 }
 
-void tlb_shootdown_ipi(int n, void *stack)
+void tlb_shootdown_ipi(int n, istate_t *istate)
 {
 	trap_virtual_eoi();
Index: arch/ia32/include/interrupt.h
===================================================================
--- arch/ia32/include/interrupt.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/include/interrupt.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -61,15 +61,31 @@
 #define VECTOR_TLB_SHOOTDOWN_IPI	(IVT_FREEBASE+1)
 
+struct istate {
+	__u32 edi;
+	__u32 esi;
+	__u32 ebp;
+	__u32 esp;
+	__u32 ebx;
+	__u32 edx;
+	__u32 ecx;
+	__u32 eax;
+	__u32 error_word;
+	__u32 eip;
+	__u32 cs;
+	__u32 eflags;
+	__u32 stack[];
+};
+
 extern void (* disable_irqs_function)(__u16 irqmask);
 extern void (* enable_irqs_function)(__u16 irqmask);
 extern void (* eoi_function)(void);
 
-extern void null_interrupt(int n, void *stack);
-extern void gp_fault(int n, void *stack);
-extern void nm_fault(int n, void *stack);
-extern void ss_fault(int n, void *stack);
-extern void page_fault(int n, void *stack);
-extern void syscall(int n, void *stack);
-extern void tlb_shootdown_ipi(int n, void *stack);
+extern void null_interrupt(int n, istate_t *istate);
+extern void gp_fault(int n, istate_t *istate);
+extern void nm_fault(int n, istate_t *istate);
+extern void ss_fault(int n, istate_t *istate);
+extern void page_fault(int n, istate_t *istate);
+extern void syscall(int n, istate_t *istate);
+extern void tlb_shootdown_ipi(int n, istate_t *istate);
 
 extern void trap_virtual_enable_irqs(__u16 irqmask);
Index: arch/ia32/include/types.h
===================================================================
--- arch/ia32/include/types.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/include/types.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -48,5 +48,5 @@
 
 typedef __u32 __native;
-typedef __s32 __native;
+typedef __s32 __snative;
 
 typedef struct page_specifier pte_t;
Index: arch/ia32/src/asm.S
===================================================================
--- arch/ia32/src/asm.S	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/asm.S	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -79,8 +79,35 @@
 #
 .macro handler i n
-	push %ebp
-	movl %esp,%ebp
+	push %eax
+
+	# Test if this is interrupt with error word or not
+	movl $(1<<\i), %eax
+	andl $ERROR_WORD_INTERRUPT_LIST,%eax
+
+	/*
+	 * If this interrupt/exception  stores error word,
+	 * we need to pop EAX.
+	 * If this interrupt doesn't store error word, we emulate it
+	 * for the sake of consistent pstate structure. In that case
+	 * we merely leave the EAX on the stack.
+	 */
+	jz 0f
+
+	/*
+	 * This exception stores error word.
+	 */
+	pop %eax
+	jmp 1f
+
+0:
+	/*
+	 * This interrupt doesn't store error word.
+	 * Just restore EAX without doing POP.
+	 */
+	movl (%esp), %eax
+
+1:
 	pusha
-
+	movl %esp, %ebp
 	push %ds
 	push %es
@@ -93,5 +120,4 @@
 	movl $(\i),%edi
 	pushl %ebp
-	addl $4,(%esp)
 	pushl %edi
 	call exc_dispatch
@@ -101,6 +127,5 @@
 	pop %ds
 
-
-# CLNT
+# Clear Nested Task flag.
 	pushfl
 	pop %eax
@@ -109,27 +134,6 @@
 	popfl
 	
-
-
-# Test if this is interrupt with error word or not
-	mov $\i,%cl
-	movl $1,%eax
-	test $0xe0,%cl
-	jnz 0f
-	and $0x1f,%cl
-	shl %cl,%eax
-	and $ERROR_WORD_INTERRUPT_LIST,%eax
-	jz 0f
-
-
-# Return with error word
 	popa
-	pop %ebp
-	add $4,%esp	# Skip error word
-	iret
-
-0:
-# Return with no error word
-	popa
-	pop %ebp
+	add $4,%esp	# Skip error word, whether real or fake.
 	iret
 
Index: arch/ia32/src/drivers/i8254.c
===================================================================
--- arch/ia32/src/drivers/i8254.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/drivers/i8254.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -54,5 +54,5 @@
 #define MAGIC_NUMBER	1194
 
-static void i8254_interrupt(int n, void *stack);
+static void i8254_interrupt(int n, istate_t *istate);
 
 void i8254_init(void)
@@ -68,5 +68,5 @@
 	outb(CLK_PORT1, (CLK_CONST/HZ) >> 8);
 	pic_enable_irqs(1<<IRQ_CLK);
-	exc_register(VECTOR_CLK, "i8254_clock", i8254_interrupt);
+	exc_register(VECTOR_CLK, "i8254_clock", (iroutine) i8254_interrupt);
 }
 
@@ -126,5 +126,5 @@
 }
 
-void i8254_interrupt(int n, void *stack)
+void i8254_interrupt(int n, istate_t *istate)
 {
 	trap_virtual_eoi();
Index: arch/ia32/src/drivers/i8259.c
===================================================================
--- arch/ia32/src/drivers/i8259.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/drivers/i8259.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -40,5 +40,5 @@
  */
 
-static void pic_spurious(int n, void *stack);
+static void pic_spurious(int n, istate_t *istate);
 
 void i8259_init(void)
@@ -71,5 +71,5 @@
 	 * Register interrupt handler for the PIC spurious interrupt.
 	 */
-	exc_register(VECTOR_PIC_SPUR, "pic_spurious", pic_spurious);	
+	exc_register(VECTOR_PIC_SPUR, "pic_spurious", (iroutine) pic_spurious);	
 
 	/*
@@ -119,5 +119,5 @@
 }
 
-void pic_spurious(int n, void *stack)
+void pic_spurious(int n, istate_t *istate)
 {
 	printf("cpu%d: PIC spurious interrupt\n", CPU->id);
Index: arch/ia32/src/ia32.c
===================================================================
--- arch/ia32/src/ia32.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/ia32.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -61,9 +61,9 @@
 		i8254_init();	/* hard clock */
 		
-		exc_register(VECTOR_SYSCALL, "syscall", syscall);
+		exc_register(VECTOR_SYSCALL, "syscall", (iroutine) syscall);
 		
 		#ifdef CONFIG_SMP
 		exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown",
-			     tlb_shootdown_ipi);
+			     (iroutine) tlb_shootdown_ipi);
 		#endif /* CONFIG_SMP */
 	}
Index: arch/ia32/src/interrupt.c
===================================================================
--- arch/ia32/src/interrupt.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/interrupt.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -50,44 +50,39 @@
 void (* eoi_function)(void) = NULL;
 
-#define PRINT_INFO_ERRCODE(st) { \
-        __native *x = (__native *) st; \
-	char *symbol = get_symtab_entry(x[1]); \
+#define PRINT_INFO_ERRCODE(istate) do { \
+	char *symbol = get_symtab_entry(istate->eip); \
 	if (!symbol) \
 		symbol = ""; \
 	printf("----------------EXCEPTION OCCURED----------------\n"); \
-	printf("%%eip: %X (%s)\n",x[1],symbol); \
-	printf("ERROR_WORD=%X\n", x[0]); \
-	printf("%%cs=%X,flags=%X\n", x[2], x[3]); \
+	printf("%%eip: %X (%s)\n",istate->eip,symbol); \
+	printf("ERROR_WORD=%X\n", istate->error_word); \
+	printf("%%cs=%X,flags=%X\n", istate->cs, istate->eflags); \
 	printf("%%eax=%X, %%ebx=%X, %%ecx=%X, %%edx=%X\n",\
-	       x[-2],x[-5],x[-3],x[-4]); \
+	       istate->eax,istate->ebx,istate->ecx,istate->edx); \
 	printf("%%esi=%X, %%edi=%X, %%ebp=%X, %%esp=%X\n",\
-	       x[-8],x[-9],x[-1],x); \
-	printf("stack: %X, %X, %X, %X\n", x[4], x[5], x[6], x[7]); \
-	printf("       %X, %X, %X, %X\n", x[8], x[9], x[10], x[11]); \
-        }
+	       istate->esi,istate->edi,istate->ebp,istate->esp); \
+	printf("stack: %X, %X, %X, %X\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); \
+	printf("       %X, %X, %X, %X\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); \
+} while(0)
 
-void null_interrupt(int n, void *st)
+void null_interrupt(int n, istate_t *istate)
 {
-	__native *stack = (__native *) st;
-
-	printf("int %d: null_interrupt\n", n);
-	printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
-	panic("unserviced interrupt\n");
+	PRINT_INFO_ERRCODE(istate);
+	panic("unserviced interrupt: %d\n", n);
 }
 
-void gp_fault(int n, void *stack)
+void gp_fault(int n, istate_t *istate)
 {
-	PRINT_INFO_ERRCODE(stack);
+	PRINT_INFO_ERRCODE(istate);
 	panic("general protection fault\n");
 }
 
-void ss_fault(int n, void *stack)
+void ss_fault(int n, istate_t *istate)
 {
-	PRINT_INFO_ERRCODE(stack);
+	PRINT_INFO_ERRCODE(istate);
 	panic("stack fault\n");
 }
 
-
-void nm_fault(int n, void *stack)
+void nm_fault(int n, istate_t *istate)
 {
 #ifdef CONFIG_FPU_LAZY     
@@ -98,7 +93,5 @@
 }
 
-
-
-void page_fault(int n, void *stack)
+void page_fault(int n, istate_t *istate)
 {
 	__address page;
@@ -106,5 +99,5 @@
 	page = read_cr2();
 	if (!as_page_fault(page)) {
-		PRINT_INFO_ERRCODE(stack);
+		PRINT_INFO_ERRCODE(istate);
 		printf("page fault address: %X\n", page);
 		panic("page fault\n");
@@ -112,17 +105,15 @@
 }
 
-void syscall(int n, void *st)
+void syscall(int n, istate_t *istate)
 {
-	__native *stack = (__native *) st;
-
 	interrupts_enable();
-	if (stack[-2] < SYSCALL_END)
-		stack[-2] = syscall_table[stack[-2]](stack[-5], stack[-3], stack[-4]);
+	if (istate->edx < SYSCALL_END)
+		istate->eax = syscall_table[istate->edx](istate->eax, istate->ebx, istate->ecx);
 	else
-		panic("Undefined syscall %d", stack[-2]);
+		panic("Undefined syscall %d", istate->edx);
 	interrupts_disable();
 }
 
-void tlb_shootdown_ipi(int n, void *stack)
+void tlb_shootdown_ipi(int n, istate_t *istate)
 {
 	trap_virtual_eoi();
Index: arch/ia32/src/mm/page.c
===================================================================
--- arch/ia32/src/mm/page.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/mm/page.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -61,5 +61,5 @@
 		}
 
-		exc_register(14, "page_fault", page_fault);
+		exc_register(14, "page_fault", (iroutine) page_fault);
 		write_cr3((__address) AS_KERNEL->page_table);
 	}
Index: arch/ia32/src/pm.c
===================================================================
--- arch/ia32/src/pm.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/pm.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -126,9 +126,9 @@
 		
 		idt_setoffset(d, ((__address) interrupt_handlers) + i*interrupt_handler_size);
-		exc_register(i, "undef", null_interrupt);
+		exc_register(i, "undef", (iroutine) null_interrupt);
 	}
-	exc_register(13, "gp_fault", gp_fault);
-	exc_register( 7, "nm_fault", nm_fault);
-	exc_register(12, "ss_fault", ss_fault);
+	exc_register(13, "gp_fault", (iroutine) gp_fault);
+	exc_register( 7, "nm_fault", (iroutine) nm_fault);
+	exc_register(12, "ss_fault", (iroutine) ss_fault);
 }
 
Index: arch/ia32/src/smp/apic.c
===================================================================
--- arch/ia32/src/smp/apic.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia32/src/smp/apic.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -113,6 +113,6 @@
 
 
-static void apic_spurious(int n, void *stack);
-static void l_apic_timer_interrupt(int n, void *stack);
+static void apic_spurious(int n, istate_t *istate);
+static void l_apic_timer_interrupt(int n, istate_t *istate);
 
 /** Initialize APIC on BSP. */
@@ -122,5 +122,5 @@
 	int i;
 
-	exc_register(VECTOR_APIC_SPUR, "apic_spurious", apic_spurious);
+	exc_register(VECTOR_APIC_SPUR, "apic_spurious", (iroutine) apic_spurious);
 
 	enable_irqs_function = io_apic_enable_irqs;
@@ -134,5 +134,5 @@
 	 */
 	io_apic_disable_irqs(0xffff);
-	exc_register(VECTOR_CLK, "l_apic_timer", l_apic_timer_interrupt);
+	exc_register(VECTOR_CLK, "l_apic_timer", (iroutine) l_apic_timer_interrupt);
 	for (i = 0; i < IRQ_COUNT; i++) {
 		int pin;
@@ -170,5 +170,5 @@
  * @param stack Interrupted stack.
  */
-void apic_spurious(int n, void *stack)
+void apic_spurious(int n, istate_t *istate)
 {
 	printf("cpu%d: APIC spurious interrupt\n", CPU->id);
@@ -428,5 +428,5 @@
  * @param stack Interrupted stack.
  */
-void l_apic_timer_interrupt(int n, void *stack)
+void l_apic_timer_interrupt(int n, istate_t *istate)
 {
 	l_apic_eoi();
Index: arch/ia64/include/interrupt.h
===================================================================
--- arch/ia64/include/interrupt.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia64/include/interrupt.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -30,4 +30,5 @@
 #define __ia64_INTERRUPT_H__
 
+#include <typedefs.h>
 #include <arch/types.h>
 #include <arch/register.h>
@@ -47,5 +48,5 @@
 #define EOI	0		/**< The actual value doesn't matter. */
 
-struct exception_regdump {
+struct istate {
 	__address ar_bsp;
 	__address ar_bspstore;
@@ -74,8 +75,8 @@
 extern void *ivt;
 
-extern void general_exception(__u64 vector, struct exception_regdump *pstate);
-extern int break_instruction(__u64 vector, struct exception_regdump *pstate);
-extern void universal_handler(__u64 vector, struct exception_regdump *pstate);
-extern void external_interrupt(__u64 vector, struct exception_regdump *pstate);
+extern void general_exception(__u64 vector, istate_t *istate);
+extern int break_instruction(__u64 vector, istate_t *istate);
+extern void universal_handler(__u64 vector, istate_t *istate);
+extern void external_interrupt(__u64 vector, istate_t *istate);
 
 #endif
Index: arch/ia64/include/mm/tlb.h
===================================================================
--- arch/ia64/include/mm/tlb.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia64/include/mm/tlb.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -83,11 +83,11 @@
 extern void itc_pte_copy(pte_t *t);
 
-extern void alternate_instruction_tlb_fault(__u64 vector, struct exception_regdump *pstate);
-extern void alternate_data_tlb_fault(__u64 vector, struct exception_regdump *pstate);
-extern void data_nested_tlb_fault(__u64 vector, struct exception_regdump *pstate);
-extern void data_dirty_bit_fault(__u64 vector, struct exception_regdump *pstate);
-extern void instruction_access_bit_fault(__u64 vector, struct exception_regdump *pstate);
-extern void data_access_bit_fault(__u64 vector, struct exception_regdump *pstate);
-extern void page_not_present(__u64 vector, struct exception_regdump *pstate);
+extern void alternate_instruction_tlb_fault(__u64 vector, istate_t *istate);
+extern void alternate_data_tlb_fault(__u64 vector, istate_t *istate);
+extern void data_nested_tlb_fault(__u64 vector, istate_t *istate);
+extern void data_dirty_bit_fault(__u64 vector, istate_t *istate);
+extern void instruction_access_bit_fault(__u64 vector, istate_t *istate);
+extern void data_access_bit_fault(__u64 vector, istate_t *istate);
+extern void page_not_present(__u64 vector, istate_t *istate);
 
 #endif
Index: arch/ia64/include/types.h
===================================================================
--- arch/ia64/include/types.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia64/include/types.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -1,3 +1,3 @@
-
+/*
  * Copyright (C) 2005 Jakub Jermar
  * All rights reserved.
@@ -48,5 +48,5 @@
 
 typedef __u64 __native;
-typedef __s64 __native;
+typedef __s64 __snative;
 
 typedef struct pte pte_t;
Index: arch/ia64/src/interrupt.c
===================================================================
--- arch/ia64/src/interrupt.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia64/src/interrupt.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -109,5 +109,5 @@
 
 static char *vector_to_string(__u16 vector);
-static void dump_interrupted_context(struct exception_regdump *pstate);
+static void dump_interrupted_context(istate_t *istate);
 
 char *vector_to_string(__u16 vector)
@@ -121,31 +121,31 @@
 }
 
-void dump_interrupted_context(struct exception_regdump *pstate)
+void dump_interrupted_context(istate_t *istate)
 {
 	char *ifa, *iipa, *iip;
 
-	ifa = get_symtab_entry(pstate->cr_ifa);
-	iipa = get_symtab_entry(pstate->cr_iipa);
-	iip = get_symtab_entry(pstate->cr_iip);
+	ifa = get_symtab_entry(istate->cr_ifa);
+	iipa = get_symtab_entry(istate->cr_iipa);
+	iip = get_symtab_entry(istate->cr_iip);
 
 	putchar('\n');
 	printf("Interrupted context dump:\n");
-	printf("ar.bsp=%P\tar.bspstore=%P\n", pstate->ar_bsp, pstate->ar_bspstore);
-	printf("ar.rnat=%Q\tar.rsc=%Q\n", pstate->ar_rnat, pstate->ar_rsc);
-	printf("ar.ifs=%Q\tar.pfs=%Q\n", pstate->ar_ifs, pstate->ar_pfs);
-	printf("cr.isr=%Q\tcr.ipsr=%Q\t\n", pstate->cr_isr.value, pstate->cr_ipsr);
+	printf("ar.bsp=%P\tar.bspstore=%P\n", istate->ar_bsp, istate->ar_bspstore);
+	printf("ar.rnat=%Q\tar.rsc=%Q\n", istate->ar_rnat, istate->ar_rsc);
+	printf("ar.ifs=%Q\tar.pfs=%Q\n", istate->ar_ifs, istate->ar_pfs);
+	printf("cr.isr=%Q\tcr.ipsr=%Q\t\n", istate->cr_isr.value, istate->cr_ipsr);
 	
-	printf("cr.iip=%Q, #%d\t(%s)\n", pstate->cr_iip, pstate->cr_isr.ei ,iip ? iip : "?");
-	printf("cr.iipa=%Q\t(%s)\n", pstate->cr_iipa, iipa ? iipa : "?");
-	printf("cr.ifa=%Q\t(%s)\n", pstate->cr_ifa, ifa ? ifa : "?");
-}
-
-void general_exception(__u64 vector, struct exception_regdump *pstate)
+	printf("cr.iip=%Q, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei ,iip ? iip : "?");
+	printf("cr.iipa=%Q\t(%s)\n", istate->cr_iipa, iipa ? iipa : "?");
+	printf("cr.ifa=%Q\t(%s)\n", istate->cr_ifa, ifa ? ifa : "?");
+}
+
+void general_exception(__u64 vector, istate_t *istate)
 {
 	char *desc = "";
 
-	dump_interrupted_context(pstate);
-
-	switch (pstate->cr_isr.ge_code) {
+	dump_interrupted_context(istate);
+
+	switch (istate->cr_isr.ge_code) {
 	    case GE_ILLEGALOP:
 		desc = "Illegal Operation fault";
@@ -175,31 +175,31 @@
 
 /** Handle syscall. */
-int break_instruction(__u64 vector, struct exception_regdump *pstate)
+int break_instruction(__u64 vector, istate_t *istate)
 {
 	/*
 	 * Move to next instruction after BREAK.
 	 */
-	if (pstate->cr_ipsr.ri == 2) {
-		pstate->cr_ipsr.ri = 0;
-		pstate->cr_iip += 16;
+	if (istate->cr_ipsr.ri == 2) {
+		istate->cr_ipsr.ri = 0;
+		istate->cr_iip += 16;
 	} else {
-		pstate->cr_ipsr.ri++;
+		istate->cr_ipsr.ri++;
 	}
 
-	if (pstate->in0 < SYSCALL_END)
-		return syscall_table[pstate->in0](pstate->in1, pstate->in2, pstate->in3);
+	if (istate->in3 < SYSCALL_END)
+		return syscall_table[istate->in3](istate->in0, istate->in1, istate->in2);
 	else
-		panic("Undefined syscall %d", pstate->in0);
+		panic("Undefined syscall %d", istate->in3);
 		
 	return -1;
 }
 
-void universal_handler(__u64 vector, struct exception_regdump *pstate)
-{
-	dump_interrupted_context(pstate);
+void universal_handler(__u64 vector, istate_t *istate)
+{
+	dump_interrupted_context(istate);
 	panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector));
 }
 
-void external_interrupt(__u64 vector, struct exception_regdump *pstate)
+void external_interrupt(__u64 vector, istate_t *istate)
 {
 	cr_ivr_t ivr;
Index: arch/ia64/src/mm/tlb.c
===================================================================
--- arch/ia64/src/mm/tlb.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/ia64/src/mm/tlb.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -443,7 +443,7 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void alternate_instruction_tlb_fault(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void alternate_instruction_tlb_fault(__u64 vector, istate_t *istate)
 {
 	region_register rr;
@@ -451,5 +451,5 @@
 	pte_t *t;
 	
-	va = pstate->cr_ifa;	/* faulting address */
+	va = istate->cr_ifa;	/* faulting address */
 	t = page_mapping_find(AS, va);
 	if (t) {
@@ -464,5 +464,5 @@
 		 */
 		if (!as_page_fault(va)) {
-			panic("%s: va=%P, rid=%d\n", __FUNCTION__, pstate->cr_ifa, rr.map.rid);
+			panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
 		}
 	}
@@ -472,7 +472,7 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void alternate_data_tlb_fault(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void alternate_data_tlb_fault(__u64 vector, istate_t *istate)
 {
 	region_register rr;
@@ -481,5 +481,5 @@
 	pte_t *t;
 	
-	va = pstate->cr_ifa;	/* faulting address */
+	va = istate->cr_ifa;	/* faulting address */
 	rr.word = rr_read(VA2VRN(va));
 	rid = rr.map.rid;
@@ -507,5 +507,5 @@
 		 */
 		if (!as_page_fault(va)) {
-			panic("%s: va=%P, rid=%d\n", __FUNCTION__, pstate->cr_ifa, rr.map.rid);
+			panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
 		}
 	}
@@ -517,7 +517,7 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void data_nested_tlb_fault(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void data_nested_tlb_fault(__u64 vector, istate_t *istate)
 {
 	panic("%s\n", __FUNCTION__);
@@ -527,11 +527,11 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void data_dirty_bit_fault(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void data_dirty_bit_fault(__u64 vector, istate_t *istate)
 {
 	pte_t *t;
 
-	t = page_mapping_find(AS, pstate->cr_ifa);
+	t = page_mapping_find(AS, istate->cr_ifa);
 	ASSERT(t && t->p);
 	if (t && t->p) {
@@ -548,11 +548,11 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void instruction_access_bit_fault(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void instruction_access_bit_fault(__u64 vector, istate_t *istate)
 {
 	pte_t *t;
 
-	t = page_mapping_find(AS, pstate->cr_ifa);
+	t = page_mapping_find(AS, istate->cr_ifa);
 	ASSERT(t && t->p);
 	if (t && t->p) {
@@ -569,11 +569,11 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void data_access_bit_fault(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void data_access_bit_fault(__u64 vector, istate_t *istate)
 {
 	pte_t *t;
 
-	t = page_mapping_find(AS, pstate->cr_ifa);
+	t = page_mapping_find(AS, istate->cr_ifa);
 	ASSERT(t && t->p);
 	if (t && t->p) {
@@ -590,7 +590,7 @@
  *
  * @param vector Interruption vector.
- * @param pstate Structure with saved interruption state.
- */
-void page_not_present(__u64 vector, struct exception_regdump *pstate)
+ * @param istate Structure with saved interruption state.
+ */
+void page_not_present(__u64 vector, istate_t *istate)
 {
 	region_register rr;
@@ -598,5 +598,5 @@
 	pte_t *t;
 	
-	va = pstate->cr_ifa;	/* faulting address */
+	va = istate->cr_ifa;	/* faulting address */
 	t = page_mapping_find(AS, va);
 	ASSERT(t);
@@ -613,6 +613,6 @@
 	} else {
 		if (!as_page_fault(va)) {
-			panic("%s: va=%P, rid=%d\n", __FUNCTION__, pstate->cr_ifa, rr.map.rid);
-		}
-	}
-}
+			panic("%s: va=%P, rid=%d\n", __FUNCTION__, istate->cr_ifa, rr.map.rid);
+		}
+	}
+}
Index: arch/mips32/include/debugger.h
===================================================================
--- arch/mips32/include/debugger.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/include/debugger.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -50,9 +50,9 @@
 	int flags;        /**< Flags regarding breakpoint */
 	count_t counter;
-	void (*bkfunc)(void *b, struct exception_regdump *pstate);
+	void (*bkfunc)(void *b, istate_t *istate);
 } bpinfo_t;
 
 extern void debugger_init(void);
-void debugger_bpoint(struct exception_regdump *pstate);
+void debugger_bpoint(istate_t *istate);
 
 extern bpinfo_t breakpoints[BKPOINTS_MAX];
Index: arch/mips32/include/exception.h
===================================================================
--- arch/mips32/include/exception.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/include/exception.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -34,4 +34,6 @@
 #endif
 
+#include <typedefs.h>
+
 #define EXC_Int		0
 #define EXC_Mod		1
@@ -53,5 +55,5 @@
 #define EXC_VCED	31
 
-struct exception_regdump {
+struct istate {
 	__u32 at;
 	__u32 v0;
@@ -91,5 +93,5 @@
 };
 
-extern void exception(struct exception_regdump *pstate);
+extern void exception(istate_t *istate);
 extern void tlb_refill_entry(void);
 extern void exception_entry(void);
Index: arch/mips32/include/mm/tlb.h
===================================================================
--- arch/mips32/include/mm/tlb.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/include/mm/tlb.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -170,7 +170,7 @@
 #define tlb_invalidate(asid)	tlb_invalidate_asid(asid)
 
-extern void tlb_invalid(struct exception_regdump *pstate);
-extern void tlb_refill(struct exception_regdump *pstate);
-extern void tlb_modified(struct exception_regdump *pstate);
+extern void tlb_invalid(istate_t *istate);
+extern void tlb_refill(istate_t *istate);
+extern void tlb_modified(istate_t *istate);
 
 #endif
Index: arch/mips32/include/thread.h
===================================================================
--- arch/mips32/include/thread.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/include/thread.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -32,5 +32,5 @@
 #include <arch/exception.h>
 
-#define ARCH_THREAD_DATA   struct exception_regdump *pstate
+#define ARCH_THREAD_DATA   istate_t *istate
 
 #endif
Index: arch/mips32/src/debugger.c
===================================================================
--- arch/mips32/src/debugger.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/debugger.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -180,5 +180,5 @@
 	} else { /* We are add extended */
 		cur->flags = BKPOINT_FUNCCALL;
-		cur->bkfunc = 	(void (*)(void *, struct exception_regdump *)) argv[1].intval;
+		cur->bkfunc = 	(void (*)(void *, istate_t *)) argv[1].intval;
 	}
 	if (is_jump(cur->instruction))
@@ -290,8 +290,8 @@
  * next instruction.
  */
-void debugger_bpoint(struct exception_regdump *pstate)
+void debugger_bpoint(istate_t *istate)
 {
 	bpinfo_t *cur = NULL;
-	__address fireaddr = pstate->epc;
+	__address fireaddr = istate->epc;
 	int i;
 
@@ -330,5 +330,5 @@
 		if (!(cur->flags & BKPOINT_FUNCCALL))
 			printf("***Breakpoint %d: 0x%p in %s.\n", i, 
-			       fireaddr, get_symtab_entry(pstate->epc));
+			       fireaddr, get_symtab_entry(istate->epc));
 
 		/* Return first instruction back */
@@ -345,5 +345,5 @@
 		       get_symtab_entry(fireaddr));
 		/* Move on to next instruction */
-		pstate->epc += 4;
+		istate->epc += 4;
 	}
 	if (cur)
@@ -352,5 +352,5 @@
 		/* Allow zero bkfunc, just for counting */
 		if (cur->bkfunc)
-			cur->bkfunc(cur, pstate);
+			cur->bkfunc(cur, istate);
 	} else {
 		printf("***Type 'exit' to exit kconsole.\n");
Index: arch/mips32/src/drivers/arc.c
===================================================================
--- arch/mips32/src/drivers/arc.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/drivers/arc.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -350,8 +350,8 @@
 iroutine old_timer;
 /** Do polling on timer interrupt */
-static void timer_replace(int n, void *stack)
+static void timer_replace(int n, istate_t *istate)
 {
 	arc_keyboard_poll();
-	old_timer(n, stack);
+	old_timer(n, istate);
 	arc_keyboard_poll();
 }
Index: arch/mips32/src/drivers/msim.c
===================================================================
--- arch/mips32/src/drivers/msim.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/drivers/msim.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -84,5 +84,5 @@
 
 /** Process keyboard interrupt. */
-static void msim_interrupt(int n, void *stack)
+static void msim_interrupt(int n, istate_t *istate)
 {
 	char ch = 0;
Index: arch/mips32/src/drivers/serial.c
===================================================================
--- arch/mips32/src/drivers/serial.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/drivers/serial.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -113,8 +113,8 @@
 iroutine old_timer;
 /** Do polling on timer interrupt */
-static void timer_replace(int n, void *stack)
+static void timer_replace(int n, istate_t *istate)
 {
-	old_timer(n, stack);
-	serial_interrupt(n, stack);
+	old_timer(n, istate);
+	serial_interrupt(n, istate);
 }
 
Index: arch/mips32/src/exception.c
===================================================================
--- arch/mips32/src/exception.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/exception.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -63,50 +63,50 @@
 };
 
-static void print_regdump(struct exception_regdump *pstate)
+static void print_regdump(istate_t *istate)
 {
 	char *pcsymbol = "";
 	char *rasymbol = "";
 
-	char *s = get_symtab_entry(pstate->epc);
+	char *s = get_symtab_entry(istate->epc);
 	if (s)
 		pcsymbol = s;
-	s = get_symtab_entry(pstate->ra);
+	s = get_symtab_entry(istate->ra);
 	if (s)
 		rasymbol = s;
 	
-	printf("PC: %X(%s) RA: %X(%s), SP(%P)\n",pstate->epc,pcsymbol,
-	       pstate->ra,rasymbol, pstate->sp);
-}
-
-static void unhandled_exception(int n, struct exception_regdump *pstate)
-{
-	print_regdump(pstate);
+	printf("PC: %X(%s) RA: %X(%s), SP(%P)\n",istate->epc,pcsymbol,
+	       istate->ra,rasymbol, istate->sp);
+}
+
+static void unhandled_exception(int n, istate_t *istate)
+{
+	print_regdump(istate);
 	panic("unhandled exception %s\n", exctable[n]);
 }
 
-static void breakpoint_exception(int n, struct exception_regdump *pstate)
+static void breakpoint_exception(int n, istate_t *istate)
 {
 #ifdef CONFIG_DEBUG
-	debugger_bpoint(pstate);
+	debugger_bpoint(istate);
 #else
 	/* it is necessary to not re-execute BREAK instruction after 
 	   returning from Exception handler
 	   (see page 138 in R4000 Manual for more information) */
-	pstate->epc += 4;
+	istate->epc += 4;
 #endif
 }
 
-static void tlbmod_exception(int n, struct exception_regdump *pstate)
-{
-	tlb_modified(pstate);
-}
-
-static void tlbinv_exception(int n, struct exception_regdump *pstate)
-{
-	tlb_invalid(pstate);
+static void tlbmod_exception(int n, istate_t *istate)
+{
+	tlb_modified(istate);
+}
+
+static void tlbinv_exception(int n, istate_t *istate)
+{
+	tlb_invalid(istate);
 }
 
 #ifdef CONFIG_FPU_LAZY
-static void cpuns_exception(int n, struct exception_regdump *pstate)
+static void cpuns_exception(int n, istate_t *istate)
 {
 	if (cp0_cause_coperr(cp0_cause_read()) == fpu_cop_id)
@@ -117,5 +117,5 @@
 #endif
 
-static void interrupt_exception(int n, struct exception_regdump *pstate)
+static void interrupt_exception(int n, istate_t *istate)
 {
 	__u32 cause;
@@ -127,24 +127,23 @@
 	for (i = 0; i < 8; i++)
 		if (cause & (1 << i))
-			exc_dispatch(i+INT_OFFSET, pstate);
+			exc_dispatch(i+INT_OFFSET, istate);
 }
 
 #include <debug.h>
 /** Handle syscall userspace call */
-static void syscall_exception(int n, struct exception_regdump *pstate)
+static void syscall_exception(int n, istate_t *istate)
 {
 	interrupts_enable();
-	if (pstate->a3 < SYSCALL_END)
-		pstate->v0 = syscall_table[pstate->a3](pstate->a0,
-						       pstate->a1,
-						       pstate->a2);
+	if (istate->a3 < SYSCALL_END)
+		istate->v0 = syscall_table[istate->a3](istate->a0,
+						       istate->a1,
+						       istate->a2);
 	else
-		panic("Undefined syscall %d", pstate->a3);
+		panic("Undefined syscall %d", istate->a3);
+	istate->epc += 4;
 	interrupts_disable();
-	pstate->epc += 4;
-}
-
-
-void exception(struct exception_regdump *pstate)
+}
+
+void exception(istate_t *istate)
 {
 	int cause;
@@ -164,15 +163,15 @@
 						cp0_status_um_bit));
 
-	/* Save pstate so that the threads can access it */
-	/* If THREAD->pstate is set, this is nested exception,
+	/* Save istate so that the threads can access it */
+	/* If THREAD->istate is set, this is nested exception,
 	 * do not rewrite it
 	 */
-	if (THREAD && !THREAD->pstate)
-		THREAD->pstate = pstate;
+	if (THREAD && !THREAD->istate)
+		THREAD->istate = istate;
 
 	cause = cp0_cause_read();
 	excno = cp0_cause_excno(cause);
 	/* Dispatch exception */
-	exc_dispatch(excno, pstate);
+	exc_dispatch(excno, istate);
 
 	/* Set to NULL, so that we can still support nested
@@ -180,8 +179,8 @@
 	 * TODO: We should probably set EXL bit before this command,
 	 * nesting. On the other hand, if some exception occurs between
-	 * here and ERET, it won't set anything on the pstate anyway.
+	 * here and ERET, it won't set anything on the istate anyway.
 	 */
 	if (THREAD)
-		THREAD->pstate = NULL;
+		THREAD->istate = NULL;
 }
 
Index: arch/mips32/src/fpu_context.c
===================================================================
--- arch/mips32/src/fpu_context.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/fpu_context.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -37,6 +37,6 @@
 #ifdef ARCH_HAS_FPU
 	cp0_status_write(cp0_status_read() & ~cp0_status_fpu_bit);
-	if (THREAD && THREAD->pstate)
-		THREAD->pstate->status &= ~cp0_status_fpu_bit;
+	if (THREAD && THREAD->istate)
+		THREAD->istate->status &= ~cp0_status_fpu_bit;
 #endif
 }
@@ -46,6 +46,6 @@
 #ifdef ARCH_HAS_FPU
 	cp0_status_write(cp0_status_read() | cp0_status_fpu_bit);
-	if (THREAD && THREAD->pstate)
-		THREAD->pstate->status |= cp0_status_fpu_bit;
+	if (THREAD && THREAD->istate)
+		THREAD->istate->status |= cp0_status_fpu_bit;
 #endif
 }
Index: arch/mips32/src/interrupt.c
===================================================================
--- arch/mips32/src/interrupt.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/interrupt.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -75,5 +75,5 @@
 }
 
-static void timer_exception(int n, void *stack)
+static void timer_exception(int n, istate_t *istate)
 {
 	cp0_compare_write(cp0_count_read() + cp0_compare_value); 
@@ -81,10 +81,10 @@
 }
 
-static void swint0(int n, void *stack)
+static void swint0(int n, istate_t *istate)
 {
 	cp0_cause_write(cp0_cause_read() & ~(1 << 8)); /* clear SW0 interrupt */
 }
 
-static void swint1(int n, void *stack)
+static void swint1(int n, istate_t *istate)
 {
 	cp0_cause_write(cp0_cause_read() & ~(1 << 9)); /* clear SW1 interrupt */
Index: arch/mips32/src/mm/tlb.c
===================================================================
--- arch/mips32/src/mm/tlb.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/mips32/src/mm/tlb.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -40,7 +40,7 @@
 #include <debug.h>
 
-static void tlb_refill_fail(struct exception_regdump *pstate);
-static void tlb_invalid_fail(struct exception_regdump *pstate);
-static void tlb_modified_fail(struct exception_regdump *pstate);
+static void tlb_refill_fail(istate_t *istate);
+static void tlb_invalid_fail(istate_t *istate);
+static void tlb_modified_fail(istate_t *istate);
 
 static pte_t *find_mapping_and_check(__address badvaddr);
@@ -82,7 +82,7 @@
  * Process TLB Refill Exception.
  *
- * @param pstate Interrupted register context.
- */
-void tlb_refill(struct exception_regdump *pstate)
+ * @param istate Interrupted register context.
+ */
+void tlb_refill(istate_t *istate)
 {
 	entry_lo_t lo;
@@ -127,5 +127,5 @@
 fail:
 	spinlock_unlock(&AS->lock);
-	tlb_refill_fail(pstate);
+	tlb_refill_fail(istate);
 }
 
@@ -134,7 +134,7 @@
  * Process TLB Invalid Exception.
  *
- * @param pstate Interrupted register context.
- */
-void tlb_invalid(struct exception_regdump *pstate)
+ * @param istate Interrupted register context.
+ */
+void tlb_invalid(istate_t *istate)
 {
 	tlb_index_t index;
@@ -196,5 +196,5 @@
 fail:
 	spinlock_unlock(&AS->lock);
-	tlb_invalid_fail(pstate);
+	tlb_invalid_fail(istate);
 }
 
@@ -203,7 +203,7 @@
  * Process TLB Modified Exception.
  *
- * @param pstate Interrupted register context.
- */
-void tlb_modified(struct exception_regdump *pstate)
+ * @param istate Interrupted register context.
+ */
+void tlb_modified(istate_t *istate)
 {
 	tlb_index_t index;
@@ -272,40 +272,40 @@
 fail:
 	spinlock_unlock(&AS->lock);
-	tlb_modified_fail(pstate);
-}
-
-void tlb_refill_fail(struct exception_regdump *pstate)
+	tlb_modified_fail(istate);
+}
+
+void tlb_refill_fail(istate_t *istate)
 {
 	char *symbol = "";
 	char *sym2 = "";
 
-	char *s = get_symtab_entry(pstate->epc);
+	char *s = get_symtab_entry(istate->epc);
 	if (s)
 		symbol = s;
-	s = get_symtab_entry(pstate->ra);
+	s = get_symtab_entry(istate->ra);
 	if (s)
 		sym2 = s;
-	panic("%X: TLB Refill Exception at %X(%s<-%s)\n", cp0_badvaddr_read(), pstate->epc, symbol, sym2);
-}
-
-
-void tlb_invalid_fail(struct exception_regdump *pstate)
+	panic("%X: TLB Refill Exception at %X(%s<-%s)\n", cp0_badvaddr_read(), istate->epc, symbol, sym2);
+}
+
+
+void tlb_invalid_fail(istate_t *istate)
 {
 	char *symbol = "";
 
-	char *s = get_symtab_entry(pstate->epc);
+	char *s = get_symtab_entry(istate->epc);
 	if (s)
 		symbol = s;
-	panic("%X: TLB Invalid Exception at %X(%s)\n", cp0_badvaddr_read(), pstate->epc, symbol);
-}
-
-void tlb_modified_fail(struct exception_regdump *pstate)
+	panic("%X: TLB Invalid Exception at %X(%s)\n", cp0_badvaddr_read(), istate->epc, symbol);
+}
+
+void tlb_modified_fail(istate_t *istate)
 {
 	char *symbol = "";
 
-	char *s = get_symtab_entry(pstate->epc);
+	char *s = get_symtab_entry(istate->epc);
 	if (s)
 		symbol = s;
-	panic("%X: TLB Modified Exception at %X(%s)\n", cp0_badvaddr_read(), pstate->epc, symbol);
+	panic("%X: TLB Modified Exception at %X(%s)\n", cp0_badvaddr_read(), istate->epc, symbol);
 }
 
Index: arch/sparc64/include/drivers/tick.h
===================================================================
--- arch/sparc64/include/drivers/tick.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/sparc64/include/drivers/tick.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -30,8 +30,10 @@
 #define __sparc64_TICK_H__
 
+#include <typedefs.h>
+
 #define TICK_DELTA        500000
 
 extern void tick_init(void);
-extern void tick_interrupt(int n, void *stack);
+extern void tick_interrupt(int n, istate_t *istate);
 
 #endif
Index: arch/sparc64/src/drivers/tick.c
===================================================================
--- arch/sparc64/src/drivers/tick.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ arch/sparc64/src/drivers/tick.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -33,4 +33,5 @@
 #include <debug.h>
 #include <time/clock.h>
+#include <typedefs.h>
 
 /** Initialize tick interrupt. */
@@ -49,7 +50,7 @@
  *
  * @param n Interrupt Level, 14,  (can be ignored)
- * @param stack Stack pointer of the interrupted context.
+ * @param istate Interrupted state.
  */
-void tick_interrupt(int n, void *stack)
+void tick_interrupt(int n, istate_t *istate)
 {
 	softint_reg_t softint, clear;
Index: genarch/src/i8042/i8042.c
===================================================================
--- genarch/src/i8042/i8042.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ genarch/src/i8042/i8042.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -266,5 +266,5 @@
 };
 
-static void i8042_interrupt(int n, void *stack);
+static void i8042_interrupt(int n, istate_t *istate);
 static void i8042_wait(void);
 
@@ -272,5 +272,5 @@
 void i8042_init(void)
 {
-	exc_register(VECTOR_KBD, "i8042_interrupt", i8042_interrupt);
+	exc_register(VECTOR_KBD, "i8042_interrupt", (iroutine) i8042_interrupt);
 	i8042_wait();
 	i8042_command_write(i8042_SET_COMMAND);
@@ -289,5 +289,5 @@
  * @param stack Interrupted stack.
  */
-void i8042_interrupt(int n, void *stack)
+void i8042_interrupt(int n, istate_t *istate)
 {
 	__u8 x;
Index: generic/include/interrupt.h
===================================================================
--- generic/include/interrupt.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ generic/include/interrupt.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -42,5 +42,5 @@
 
 extern iroutine exc_register(int n, const char *name, iroutine f);
-extern void exc_dispatch(int n, void *stack);
+extern void exc_dispatch(int n, istate_t *t);
 void exc_init(void);
 
Index: generic/include/typedefs.h
===================================================================
--- generic/include/typedefs.h	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ generic/include/typedefs.h	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -83,5 +83,6 @@
 typedef struct cmd_info cmd_info_t;
 
-typedef void (* iroutine)(int n, void *stack);
+typedef struct istate istate_t;
+typedef void (* iroutine)(int n, istate_t *istate);
 
 typedef struct hash_table hash_table_t;
Index: generic/src/interrupt/interrupt.c
===================================================================
--- generic/src/interrupt/interrupt.c	(revision 45d6adde55643185b15a7b3933e371a72a6769d8)
+++ generic/src/interrupt/interrupt.c	(revision 25d77096d63abbb97d50a9cafaf9e3e5379a6f5d)
@@ -72,13 +72,13 @@
  * CPU is interrupts_disable()'d.
  */
-void exc_dispatch(int n, void *stack)
+void exc_dispatch(int n, istate_t *istate)
 {
 	ASSERT(n < IVT_ITEMS);
 	
-	exc_table[n].f(n + IVT_FIRST, stack);
+	exc_table[n].f(n + IVT_FIRST, istate);
 }
 
 /** Default 'null' exception handler */
-static void exc_undef(int n, void *stack)
+static void exc_undef(int n, istate_t *istate)
 {
 	panic("Unhandled exception %d.", n);
@@ -127,5 +127,5 @@
 
 	for (i=0;i < IVT_ITEMS; i++)
-		exc_register(i, "undef", exc_undef);
+		exc_register(i, "undef", (iroutine) exc_undef);
 
 	cmd_initialize(&exc_info);
