From: Haavard Skinnemoen Date: Mon, 19 May 2008 09:27:37 +0000 (+0200) Subject: avr32: Do stricter stack checking in the exception handler X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=95107b7c028806919630bf02c653aa8f4f867c94;p=project%2Fbcm63xx%2Fu-boot.git avr32: Do stricter stack checking in the exception handler Don't do a stack dump if the stack pointer is outside the memory area reserved for stack. Signed-off-by: Haavard Skinnemoen --- diff --git a/cpu/at32ap/exception.c b/cpu/at32ap/exception.c index 0672685cd0..dc9c3002a4 100644 --- a/cpu/at32ap/exception.c +++ b/cpu/at32ap/exception.c @@ -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);