avr32: Do stricter stack checking in the exception handler
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Mon, 19 May 2008 09:27:37 +0000 (11:27 +0200)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Tue, 27 May 2008 13:27:30 +0000 (15:27 +0200)
Don't do a stack dump if the stack pointer is outside the memory area
reserved for stack.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
cpu/at32ap/exception.c

index 0672685cd024ba80e470dcd930b85b0d6f56e54f..dc9c3002a49631522d01ec8a7a66b3ab13c1cf12 100644 (file)
@@ -111,7 +111,8 @@ void do_unknown_exception(unsigned int ecr, struct pt_regs *regs)
        printf("CPU Mode: %s\n", cpu_modes[mode]);
 
        /* Avoid exception loops */
-       if (regs->sp < CFG_SDRAM_BASE || regs->sp >= gd->stack_end)
+       if (regs->sp < (gd->stack_end - CONFIG_STACKSIZE)
+                       || regs->sp >= gd->stack_end)
                printf("\nStack pointer seems bogus, won't do stack dump\n");
        else
                dump_mem("\nStack: ", regs->sp, gd->stack_end);