diff options
author | Ryan Grimm <grimm@linux.vnet.ibm.com> | 2016-03-03 15:58:12 -0500 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-03-04 16:06:51 +1100 |
commit | fbf1bb983af879cfa7c7d5283cd17d5c254753ae (patch) | |
tree | bbe0a4299d4699b7838f21d68dd198c1df4cdb70 /core/stack.c | |
parent | 133c07bd7fc2f4ef5c85556d1537d995f9c07f94 (diff) | |
download | skiboot-fbf1bb983af879cfa7c7d5283cd17d5c254753ae.zip skiboot-fbf1bb983af879cfa7c7d5283cd17d5c254753ae.tar.gz skiboot-fbf1bb983af879cfa7c7d5283cd17d5c254753ae.tar.bz2 |
Fix early backtraces
If we fail an assert() before we add a mem region, such as missing chip-id in a
dt xscom node, we don't get a backtrace:
[836883,0] Assert fail: core/device.c:870:id != 0xffffffff
[848859,0] Aborting!
CPU 0000 Backtrace:
This patch adjusts the top_of_ram value compared to the fp stack frame to
assume one stack early on so we get a backtrace:
[440546,0] Assert fail: core/device.c:822:id != 0xffffffff
[452522,0] Aborting!
CPU 0000 Backtrace:
S: 0000000031c03b70 R: 00000000300135d0 .backtrace+0x24
S: 0000000031c03bf0 R: 0000000030017f38 ._abort+0x4c
S: 0000000031c03c70 R: 0000000030017fb4 .assert_fail+0x34
S: 0000000031c03cf0 R: 0000000030021830 .dt_get_chip_id+0x24
S: 0000000031c03d60 R: 00000000300143cc .init_chips+0x23c
S: 0000000031c03e30 R: 0000000030013ab8 .main_cpu_entry+0x110
S: 0000000031c03f00 R: 000000003000254c boot_entry+0x19c
Signed-off-by: Ryan Grimm <grimm@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/stack.c')
-rw-r--r-- | core/stack.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/stack.c b/core/stack.c index 17f89d4..5fba6c7 100644 --- a/core/stack.c +++ b/core/stack.c @@ -32,10 +32,15 @@ void __nomcount __backtrace(struct bt_entry *entries, unsigned int *count) { unsigned int room = *count; unsigned long *fp = __builtin_frame_address(1); + unsigned long top_adj = top_of_ram; + + /* Assume one stack for early backtraces */ + if (top_of_ram == SKIBOOT_BASE + SKIBOOT_SIZE) + top_adj = top_of_ram + STACK_SIZE; *count = 0; while(room) { - if (!fp || (unsigned long)fp > top_of_ram) + if (!fp || (unsigned long)fp > top_adj) break; entries->sp = (unsigned long)fp; entries->pc = fp[2]; |