Index: kernel/arch/mips32/src/debug/stacktrace.c
===================================================================
--- kernel/arch/mips32/src/debug/stacktrace.c	(revision 20235a356988dff15276fd66d391230fc9b32591)
+++ kernel/arch/mips32/src/debug/stacktrace.c	(revision 0c39b96f240cc84cb85e0065c8c0d871185a2afc)
@@ -180,5 +180,5 @@
 					return false;
 				/* too big offsets are suspicious */
-				if (offset > 32 * 4)
+				if ((size_t) offset > sizeof(istate_t))
 					return false;
 
Index: kernel/arch/mips32/src/start.S
===================================================================
--- kernel/arch/mips32/src/start.S	(revision 20235a356988dff15276fd66d391230fc9b32591)
+++ kernel/arch/mips32/src/start.S	(revision 0c39b96f240cc84cb85e0065c8c0d871185a2afc)
@@ -91,4 +91,15 @@
 
 /*
+ * The fake ABI prologue is never executed and may not be part of the
+ * procedure's body. Instead, it should be immediately preceding the procedure's
+ * body. Its only purpose is to trick the stack trace walker into thinking that
+ * the exception is more or less just a normal function call.
+ */
+.macro FAKE_ABI_PROLOGUE
+	sub $sp, ISTATE_SOFT_SIZE
+	sw $ra, ISTATE_OFFSET_EPC($sp)
+.endm
+
+/*
  * Save registers to space defined by \r
  * We will change status: Disable ERL, EXL, UM, IE
@@ -251,4 +262,5 @@
 	nop
 
+	FAKE_ABI_PROLOGUE
 exception_handler:
 	KERNEL_STACK_TO_K0
@@ -293,5 +305,4 @@
  */
 syscall_shortcut:
-	/* we have a lot of space on the stack, with free use */
 	mfc0 $t3, $epc
 	mfc0 $t2, $status
@@ -339,4 +350,5 @@
 	eret
 
+	FAKE_ABI_PROLOGUE
 tlb_refill_handler:
 	KERNEL_STACK_TO_K0
@@ -352,4 +364,5 @@
 	eret
 
+	FAKE_ABI_PROLOGUE
 cache_error_handler:
 	KERNEL_STACK_TO_K0
