From 75dbc389ec62d9ec85178eb5364850c7f9a77997 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Mon, 15 Oct 2012 15:19:43 -0700 Subject: Clean up stack checking code Several small improvements of the stack checking code: - move the CPU0 stack check right before jumping to the payload and out of hardwaremain (that file is too crowded anyways) - fix prototype in lib.h - print size of used stack - use checkstack function both on CPU0 and CPU1-x - print amount of stack used per core Signed-off-by: Stefan Reinauer Test: Boot coreboot on Link, see the following output: ... CPU1: stack: 00156000 - 00157000, lowest used address 00156c68, stack used: 920 bytes CPU2: stack: 00155000 - 00156000, lowest used address 00155c68, stack used: 920 bytes CPU3: stack: 00154000 - 00155000, lowest used address 00154c68, stack used: 920 bytes ... Jumping to boot code at 1110008 CPU0: stack: 00157000 - 00158000, lowest used address 00157af8, stack used: 1288 bytes Change-Id: I7b83eeee0186559a0a62daa12e3f7782990fd2df Reviewed-on: http://review.coreboot.org/1787 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/lib/stack.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/stack.c b/src/lib/stack.c index 3f04b63828..0a6637f256 100644 --- a/src/lib/stack.c +++ b/src/lib/stack.c @@ -35,15 +35,17 @@ int checkstack(void *top_of_stack, int core) return -1; } - for(i = 0; i < CONFIG_STACK_SIZE/sizeof(stack[0]); i++){ + for(i = 1; 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, + printk(BIOS_SPEW, "CPU%d: stack: %p - %p, ", + core, stack, &stack[CONFIG_STACK_SIZE/sizeof(stack[0])]); - printk(BIOS_SPEW, "Lowest stack address %p\n", &stack[i]); - return -1; + printk(BIOS_SPEW, "lowest used address %p, ", &stack[i]); + printk(BIOS_SPEW, "stack used: %ld bytes\n", + (unsigned long)&stack[CONFIG_STACK_SIZE / + sizeof(stack[0])] - (unsigned long)&stack[i]); + return 0; } return 0; -- cgit v1.2.3