summaryrefslogtreecommitdiff
path: root/cpu/at32ap/exception.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-05-19 11:27:37 +0200
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-05-27 15:27:30 +0200
commit95107b7c028806919630bf02c653aa8f4f867c94 (patch)
tree07db1bbb08680ce198b3e41b6c2cf3d6163aedf7 /cpu/at32ap/exception.c
parentcaf83ea888a0220f41747d0b7748fa43b4a4bd49 (diff)
downloadu-boot-imx-95107b7c028806919630bf02c653aa8f4f867c94.zip
u-boot-imx-95107b7c028806919630bf02c653aa8f4f867c94.tar.gz
u-boot-imx-95107b7c028806919630bf02c653aa8f4f867c94.tar.bz2
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 <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'cpu/at32ap/exception.c')
-rw-r--r--cpu/at32ap/exception.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpu/at32ap/exception.c b/cpu/at32ap/exception.c
index 0672685..dc9c300 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);