summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc1
-rw-r--r--src/lib/stack.c51
2 files changed, 52 insertions, 0 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 7c081ac269..a3235a2062 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -39,6 +39,7 @@ ramstage-y += version.c
ramstage-y += cbfs.c
ramstage-y += lzma.c
#ramstage-y += lzmadecode.c
+ramstage-y += stack.c
ramstage-y += gcc.c
ramstage-y += clog2.c
ramstage-y += cbmem.c
diff --git a/src/lib/stack.c b/src/lib/stack.c
new file mode 100644
index 0000000000..3f04b63828
--- /dev/null
+++ b/src/lib/stack.c
@@ -0,0 +1,51 @@
+/*
+This software and ancillary information (herein called SOFTWARE )
+called LinuxBIOS is made available under the terms described
+here. The SOFTWARE has been approved for release with associated
+LA-CC Number 00-34 . Unless otherwise indicated, this SOFTWARE has
+been authored by an employee or employees of the University of
+California, operator of the Los Alamos National Laboratory under
+Contract No. W-7405-ENG-36 with the U.S. Department of Energy. The
+U.S. Government has rights to use, reproduce, and distribute this
+SOFTWARE. The public may copy, distribute, prepare derivative works
+and publicly display this SOFTWARE without charge, provided that this
+Notice and any statement of authorship are reproduced on all copies.
+Neither the Government nor the University makes any warranty, express
+or implied, or assumes any liability or responsibility for the use of
+this SOFTWARE. If SOFTWARE is modified to produce derivative works,
+such modified SOFTWARE should be clearly marked, so as not to confuse
+it with the version available from LANL.
+ */
+/* Copyright 2000, Ron Minnich, Advanced Computing Lab, LANL
+ * rminnich@lanl.gov
+ */
+
+#include <lib.h>
+#include <console/console.h>
+
+int checkstack(void *top_of_stack, int core)
+{
+ int i;
+ u32 *stack = (u32 *) (top_of_stack - CONFIG_STACK_SIZE);
+
+ if (stack[0] != 0xDEADBEEF){
+ printk(BIOS_ERR, "Stack overrun on CPU%d."
+ "Increase stack from current %d bytes\n",
+ CONFIG_STACK_SIZE, core);
+ return -1;
+ }
+
+ for(i = 0; i < CONFIG_STACK_SIZE/sizeof(stack[0]); i++){
+ if (stack[i] == 0xDEADBEEF)
+ continue;
+ printk(BIOS_SPEW, "CPU%d: stack from %p to %p:",
+ core,
+ stack,
+ &stack[CONFIG_STACK_SIZE/sizeof(stack[0])]);
+ printk(BIOS_SPEW, "Lowest stack address %p\n", &stack[i]);
+ return -1;
+ }
+
+ return 0;
+
+}