diff options
author | David Hendricks <dhendrix@chromium.org> | 2013-02-15 17:50:20 -0800 |
---|---|---|
committer | David Hendricks <dhendrix@chromium.org> | 2013-02-19 00:57:41 +0100 |
commit | b313e90162fcc305178d26408533b183ce045965 (patch) | |
tree | e32f999c9adf87acb0449e0830dd2216e5c381ed /src/arch | |
parent | 384ee9f1429db8543724e868b7ffd5fc7e2aa915 (diff) | |
download | coreboot-b313e90162fcc305178d26408533b183ce045965.tar.xz |
armv7: init stack to 0xdeadbeef to detect stack overflows
This adds a simple loop which initializes the stack to 0xdeadbeef
which is used by checkstack().
Change-Id: I8aecf7bfb1067de68c4080c1fcb7eefa28fd04a7
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/2421
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/armv7/bootblock.inc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/arch/armv7/bootblock.inc b/src/arch/armv7/bootblock.inc index c8cfe5eb37..da063a6786 100644 --- a/src/arch/armv7/bootblock.inc +++ b/src/arch/armv7/bootblock.inc @@ -71,6 +71,21 @@ reset: cmp r1, #0 bne wait_for_interrupt @ If this is not core0, wait + /* + * Initialize the stack to a known value. This is used to check for + * stack overflow later in the boot process. + */ + ldr r0, .Stack + ldr r1, .Stack_size + sub r0, r0, r1 + ldr r1, .Stack + ldr r2, =0xdeadbeef +init_stack_loop: + str r2, [r0] + add r0, #4 + cmp r0, r1 + bne init_stack_loop + /* Set stackpointer in internal RAM to call board_init_f */ call_bootblock: ldr sp, .Stack /* Set up stack pointer */ @@ -95,3 +110,6 @@ wait_for_interrupt: .align 2 .Stack: .word CONFIG_STACK_TOP +.align 2 +.Stack_size: + .word CONFIG_STACK_SIZE |