aboutsummaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-04-27 21:08:07 +1000
committerOliver O'Halloran <oohall@gmail.com>2020-06-11 12:52:55 +1000
commitdca0d5345631fb8d116eaf015416a6a51ead6028 (patch)
treeb915839cd60658fbd16e971262b881cd153b8864 /asm
parentac08f4aa9c772eb03b2460500c64b77822f05bf4 (diff)
downloadskiboot-dca0d5345631fb8d116eaf015416a6a51ead6028.zip
skiboot-dca0d5345631fb8d116eaf015416a6a51ead6028.tar.gz
skiboot-dca0d5345631fb8d116eaf015416a6a51ead6028.tar.bz2
core: interrupt markers for stack traces
Use magic marker in the exception stack frame that is used by the unwinder to decode the interrupt type and NIA. The below example trace comes from a modified skiboot that uses virtual memory, but any interrupt type will appear similarly. CPU 0000 Backtrace: S: 0000000031c13580 R: 0000000030028210 .vm_dsi+0x360 S: 0000000031c13630 R: 000000003003b0dc .exception_entry+0x4fc S: 0000000031c13830 R: 0000000030001f4c exception_entry_foo+0x4 --- Interrupt 0x300 at 000000003002431c --- S: 0000000031c13b40 R: 000000003002430c .make_free.isra.0+0x110 S: 0000000031c13bd0 R: 0000000030025198 .mem_alloc+0x4a0 S: 0000000031c13c80 R: 0000000030028bac .__memalign+0x48 S: 0000000031c13d10 R: 0000000030028da4 .__zalloc+0x18 S: 0000000031c13d90 R: 000000003002fb34 .opal_init_msg+0x34 S: 0000000031c13e20 R: 00000000300234b4 .main_cpu_entry+0x61c S: 0000000031c13f00 R: 00000000300031b8 boot_entry+0x1b0 --- OPAL boot --- Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [oliver: the new stackentry fields made our test heaps too small] Signed-off-by: Oliver O'Halloran <oohall@gmail.com> fixup! core: interrupt markers for stack traces
Diffstat (limited to 'asm')
-rw-r--r--asm/asm-offsets.c1
-rw-r--r--asm/head.S5
2 files changed, 6 insertions, 0 deletions
diff --git a/asm/asm-offsets.c b/asm/asm-offsets.c
index 2328d4d..7be0a11 100644
--- a/asm/asm-offsets.c
+++ b/asm/asm-offsets.c
@@ -38,6 +38,7 @@ int main(void)
OFFSET(CPUTHREAD_STACK_BOT_TOK, cpu_thread, stack_bot_tok);
#endif
OFFSET(STACK_TYPE, stack_frame, type);
+ OFFSET(STACK_MAGIC, stack_frame, magic);
OFFSET(STACK_LOCALS, stack_frame, locals);
OFFSET(STACK_GPR0, stack_frame, gpr[0]);
OFFSET(STACK_GPR1, stack_frame, gpr[1]);
diff --git a/asm/head.S b/asm/head.S
index d6514fc..3b41815 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -176,6 +176,7 @@ _exception:
mfspr %r3,SPR_SRR0
mfspr %r4,SPR_SRR1
std %r3,STACK_SRR0(%r1)
+ std %r3,16(%r1)
std %r4,STACK_SRR1(%r1)
mfspr %r3,SPR_DSISR
mfspr %r4,SPR_DAR
@@ -231,6 +232,8 @@ _exception:
stw %r4,STACK_XER(%r1)
std %r5,STACK_CTR(%r1)
std %r6,STACK_LR(%r1)
+ LOAD_IMM64(%r3,STACK_INT_MAGIC)
+ std %r3,STACK_MAGIC(%r1)
LOAD_IMM64(%r4, SKIBOOT_BASE)
LOAD_IMM32(%r5,__toc_start - __head)
LOAD_IMM32(%r6, exception_entry_foo - __head)
@@ -928,6 +931,8 @@ opal_entry:
/* Store token in CPU thread */
std %r0,CPUTHREAD_CUR_TOKEN(%r16)
+ LOAD_IMM64(%r12,STACK_INT_MAGIC)
+ std %r12,STACK_MAGIC(%r1)
/* Mark the stack frame */
li %r12,STACK_ENTRY_OPAL_API
std %r12,STACK_TYPE(%r1)