aboutsummaryrefslogtreecommitdiff
path: root/asm/head.S
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-04-08 16:49:36 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-04-18 20:23:07 -0500
commitad0941960bd045644f6834d6e711bedbde3c29c8 (patch)
treefd9ce3232321c2a2e531252ed456dc9616cf2eb8 /asm/head.S
parentc4fd54bf413e74146e74ed173b358b88f25ece3d (diff)
downloadskiboot-ad0941960bd045644f6834d6e711bedbde3c29c8.zip
skiboot-ad0941960bd045644f6834d6e711bedbde3c29c8.tar.gz
skiboot-ad0941960bd045644f6834d6e711bedbde3c29c8.tar.bz2
core/stack: backtrace unwind basic OPAL call details
Put OPAL callers' r1 into the stack back chain, and then use that to unwind back to the OPAL entry frame (as opposed to boot entry, which has a 0 back chain). >From there, dump the OPAL call token and the caller's r1. A backtrace looks like this: CPU 0000 Backtrace: S: 0000000031c03ba0 R: 000000003001a548 ._abort+0x4c S: 0000000031c03c20 R: 000000003001baac .opal_run_pollers+0x3c S: 0000000031c03ca0 R: 000000003001bcbc .opal_poll_events+0xc4 S: 0000000031c03d20 R: 00000000300051dc opal_entry+0x12c --- OPAL call entry token: 0xa caller R1: 0xc0000000006d3b90 --- This is pretty basic for the moment, but it does give you the bottom of the Linux stack. It will allow some interesting improvements in future. First, with the eframe, all the call's parameters can be printed out as well. The ___backtrace / ___print_backtrace API needs to be reworked in order to support this, but it's otherwise very simple (see opal_trace_entry()). Second, it will allow Linux's stack to be passed back to Linux via a debugging opal call. This will allow Linux's BUG() or xmon to also print the Linux back trace in case of a NMI or MCE or watchdog lockup that hits in OPAL. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'asm/head.S')
-rw-r--r--asm/head.S6
1 files changed, 5 insertions, 1 deletions
diff --git a/asm/head.S b/asm/head.S
index 8049d78..ad30625 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -359,7 +359,10 @@ boot_entry:
/* Get ready for C code: get a stack */
2: GET_STACK(%r1,%r31)
- /* Clear up initial frame */
+ /* Clear up initial frame.
+ * Zero back chain indicates stack entry from boot,
+ * non-zero indicates entry from OS (see backtrace code).
+ */
li %r3,0
std %r3,0(%r1)
std %r3,8(%r1)
@@ -965,6 +968,7 @@ opal_entry:
stdu %r12,-STACK_FRAMESIZE(%r12)
/* Save caller r1, establish new r1 */
+ std %r1,0(%r12)
std %r1,STACK_GPR1(%r12)
mr %r1,%r12