Don't do a stack dump if the stack pointer is outside the memory area
reserved for stack.

Signed-off-by: Haavard Skinnemoen <[EMAIL PROTECTED]>
---
 cpu/at32ap/exception.c |    3 ++-
 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);
-- 
1.5.5.1


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to