diff options
author | Stefan Reinauer <reinauer@chromium.org> | 2012-10-15 15:19:43 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-11-13 18:25:17 +0100 |
commit | 75dbc389ec62d9ec85178eb5364850c7f9a77997 (patch) | |
tree | d8edbdbea72689f646774f87e1d419ebcd6dd5f3 /src/boot | |
parent | 4221a195745837b05725d7ffeda415516ac44a7f (diff) | |
download | coreboot-75dbc389ec62d9ec85178eb5364850c7f9a77997.tar.gz coreboot-75dbc389ec62d9ec85178eb5364850c7f9a77997.tar.bz2 coreboot-75dbc389ec62d9ec85178eb5364850c7f9a77997.zip |
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 <reinauer@google.com>
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 <rminnich@gmail.com>
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/hardwaremain.c | 6 | ||||
-rw-r--r-- | src/boot/selfboot.c | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/boot/hardwaremain.c b/src/boot/hardwaremain.c index c90742e190f8..95dd988e16ef 100644 --- a/src/boot/hardwaremain.c +++ b/src/boot/hardwaremain.c @@ -137,12 +137,6 @@ void hardwaremain(int boot_complete) if (! payload) die("Could not find a payload\n"); - printk(BIOS_DEBUG, "Got a payload\n"); - /* Before we go off to run the payload, see if - * we stayed within our bounds. - */ - checkstack(&_estack, 0); - selfboot(lb_mem, payload); printk(BIOS_EMERG, "Boot failed"); } diff --git a/src/boot/selfboot.c b/src/boot/selfboot.c index fd5b382764e9..2556a14d6e5c 100644 --- a/src/boot/selfboot.c +++ b/src/boot/selfboot.c @@ -519,6 +519,11 @@ int selfboot(struct lb_memory *mem, struct cbfs_payload *payload) timestamp_add_now(TS_SELFBOOT_JUMP); #endif + /* Before we go off to run the payload, see if + * we stayed within our bounds. + */ + checkstack(_estack, 0); + /* Jump to kernel */ jmp_to_elf_entry((void*)entry, bounce_buffer, bounce_size); return 1; |