aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@chromium.org>2012-06-12 16:29:32 -0700
committerRonald G. Minnich <rminnich@gmail.com>2012-07-24 23:29:12 +0200
commit9764d4c690bbe4a54429e47a2094230da5fb88f5 (patch)
treee70c8afc9990fa34bf8cfd2df22370e90c231940 /src/include
parent9842ad8ac5256d1800490c392b8cf7e4edd21ddc (diff)
Implement stack overflow checking for the BSP
Previous patches implemented stack overflow checking for the APs. This patch builds on the BSP stack poisoning patch to implement stack overflow checking for the BSP, and also prints out maximum stack usage. It reveals that our 32K stack is ridiculously oversized, especially now that the lzma decoder doesn't use a giant 16K on-stack array. Break the stack checking out into a separate function, which we will later use for the APs. CPU0: stack from 00180000 to 00188000:Lowest stack address 00187ad8 To test failure, change the DEADBEEF stack poison value in c_start.S to something else. Then we should get an error like this: Stack overrun on BSP.Increase stack from current 32768 bytes CPU0: stack from 00180000 to 00188000:Lowest stack address 00180000 Separate the act of loading from the act of starting the payload. This allows us better error management and reporting of stack use. Now we see: CPU0: stack from 00180000 to 00188000:Lowest stack address 00187ad8 Tested for both success and failure on Link. At the same time, feel free to carefully check my manipulation of _estack. Change-Id: Ibb09738b15ec6a5510ac81e45dd82756bfa5aac2 Signed-off-by: Ronald G. Minnich <rminnich@chromium.org> Reviewed-on: http://review.coreboot.org/1286 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/cbfs.h1
-rw-r--r--src/include/lib.h8
2 files changed, 8 insertions, 1 deletions
diff --git a/src/include/cbfs.h b/src/include/cbfs.h
index 148317702a..b33e9327a8 100644
--- a/src/include/cbfs.h
+++ b/src/include/cbfs.h
@@ -57,5 +57,6 @@ void *cbfs_load_stage(const char *name);
int cbfs_execute_stage(const char *name);
void *cbfs_load_optionrom(u16 vendor, u16 device, void * dest);
int run_address(void *f);
+int selfboot(struct lb_memory *mem, struct cbfs_payload *payload);
#endif
diff --git a/src/include/lib.h b/src/include/lib.h
index ea098874c5..b2f38a828f 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -21,7 +21,7 @@
#ifndef __LIB_H__
#define __LIB_H__
-
+#include <stdint.h>
#ifndef __ROMCC__ /* romcc doesn't support prototypes. */
#ifndef __PRE_RAM__ /* Conflicts with romcc_io.h */
@@ -40,6 +40,12 @@ void ram_check(unsigned long start, unsigned long stop);
int ram_check_nodie(unsigned long start, unsigned long stop);
void quick_ram_check(void);
+/* Defined in src/lib/stack.c */
+int checkstack(void *top_of_stack, int stacksize);
+
+/* currently defined by a ldscript */
+extern u8 _estack;
+
/* Defined in romstage.c */
#if CONFIG_CPU_AMD_GEODE_LX
void cache_as_ram_main(void);