Index: kernel/arch/ia32/src/asm.S
===================================================================
--- kernel/arch/ia32/src/asm.S	(revision ccb426c40c1bb63880c8f1dd8edb16e9b19286f9)
+++ kernel/arch/ia32/src/asm.S	(revision 7008097ca6a0a187b98a9b23513d2488c87252d5)
@@ -163,4 +163,6 @@
 	pushl %edi	# remember return user address
 
+	xorl %ebp, %ebp	# stop stack traces here
+
 	pushl %gs	# remember TLS
 
@@ -196,5 +198,5 @@
 # and call exc_dispatch().
 #
-#define INTERRUPT_ALIGN 64
+#define INTERRUPT_ALIGN	128 
 .macro handler i n
 	
@@ -224,5 +226,7 @@
 		movw %ax, %ds
 		movw %ax, %es
-		
+	
+		xorl %ebp, %ebp
+
 		cld
 		sti
@@ -230,5 +234,7 @@
 		call syscall_handler
 		cli
-		addl $28, %esp         # clean-up of parameters
+
+		movl 20(%esp), %ebp	# restore EBP
+		addl $28, %esp		# clean-up of parameters
 		
 		popl %gs
@@ -280,7 +286,10 @@
 		movw %ax, %es
 		
-		# stop stack traces here
+		# stop stack traces here if we came from userspace
+		cmpl $8, 40(%esp)
+		jz 0f
 		xorl %ebp, %ebp
-		
+
+0:		
 		pushl %esp          # *istate
 		pushl $(\i)         # intnum
Index: kernel/arch/ia32/src/debug/panic.s
===================================================================
--- kernel/arch/ia32/src/debug/panic.s	(revision ccb426c40c1bb63880c8f1dd8edb16e9b19286f9)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# 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.
-#
-
-.text
-.global panic_printf
-
-panic_printf:
-	movl $halt, (%esp)	# fake stack to make printf return to halt
-	jmp printf
Index: kernel/arch/ia32/src/interrupt.c
===================================================================
--- kernel/arch/ia32/src/interrupt.c	(revision ccb426c40c1bb63880c8f1dd8edb16e9b19286f9)
+++ kernel/arch/ia32/src/interrupt.c	(revision 7008097ca6a0a187b98a9b23513d2488c87252d5)
@@ -65,19 +65,8 @@
 void decode_istate(istate_t *istate)
 {
-	const char *symbol = symtab_fmt_name_lookup(istate->eip);
-	
-	if (CPU)
-		printf("----------------EXCEPTION OCCURED (cpu%u)----------------\n", CPU->id);
-	else
-		printf("----------------EXCEPTION OCCURED----------------\n");
-	
-	printf("%%eip: %#lx (%s)\n", istate->eip, symbol);
-	printf("ERROR_WORD=%#lx\n", istate->error_word);
-	printf("%%cs=%#lx,flags=%#lx\n", istate->cs, istate->eflags);
-	printf("%%eax=%#lx, %%ecx=%#lx, %%edx=%#lx, %%esp=%p\n", istate->eax, istate->ecx, istate->edx, &istate->stack[0]);
-	printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);
-	printf("       %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);
-	
-	stack_trace_istate(istate);
+	printf("error_word=%#lx\n", istate->error_word);
+	printf("cs =%#0.8lx\teflags=%#0.8lx\n", istate->cs, istate->eflags);
+	printf("eax=%#0.8lx\tecx=%#0.8lx\tedx=%#0.8lx\n",
+	    istate->eax, istate->ecx, istate->edx);
 }
 
@@ -94,7 +83,5 @@
 {
 	fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n);
-	
-	decode_istate(istate);
-	panic("Unserviced interrupt: %u.", n);
+	panic_badtrap(istate, n, "Unserviced interrupt: %u.", n);
 }
 
@@ -102,7 +89,5 @@
 {
 	fault_if_from_uspace(istate, "Divide error.");
-	
-	decode_istate(istate);
-	panic("Divide error.");
+	panic_badtrap(istate, n, "Divide error.");
 }
 
@@ -128,7 +113,5 @@
 		fault_if_from_uspace(istate, "General protection fault.");
 	}
-	
-	decode_istate(istate);
-	panic("General protection fault.");
+	panic_badtrap(istate, n, "General protection fault.");
 }
 
@@ -136,7 +119,5 @@
 {
 	fault_if_from_uspace(istate, "Stack fault.");
-	
-	decode_istate(istate);
-	panic("Stack fault.");
+	panic_badtrap(istate, n, "Stack fault.");
 }
 
@@ -149,10 +130,7 @@
 	);
 	
-	fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx.",
+	fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR=%#0.8x.",
 	    (unative_t) mxcsr);
-	
-	decode_istate(istate);
-	printf("MXCSR: %#lx\n", mxcsr);
-	panic("SIMD FP exception(19).");
+	panic_badtrap(istate, n, "SIMD FP exception, MXCSR=%#0.8x");
 }
 
@@ -164,5 +142,5 @@
 #else
 	fault_if_from_uspace(istate, "FPU fault.");
-	panic("FPU fault.");
+	panic_badtrap(istate, n, "FPU fault.");
 #endif
 }
Index: kernel/arch/ia32/src/mm/page.c
===================================================================
--- kernel/arch/ia32/src/mm/page.c	(revision ccb426c40c1bb63880c8f1dd8edb16e9b19286f9)
+++ kernel/arch/ia32/src/mm/page.c	(revision 7008097ca6a0a187b98a9b23513d2488c87252d5)
@@ -115,8 +115,5 @@
 	if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
 		fault_if_from_uspace(istate, "Page fault: %#x.", page);
-		
-		decode_istate(istate);
-		printf("page fault address: %#lx\n", page);
-		panic("Page fault.");
+		panic_memtrap(istate, access, page, "Page fault.");
 	}
 }
