Commit ef41b5c9 authored by Russell King's avatar Russell King

ARM: make kernel oops easier to read

We don't need the offset for the first function name in each backtrace
entry; this needlessly consumes screen space.  This is virtually always
the first or second instruction in the called function.

Also, recognise stmfd instructions which include r10 as a valid stack
saving instruction, and when dumping the registers, dump six registers
per line rather than five, and fix the wrapping.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 92341c83
...@@ -56,7 +56,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long); ...@@ -56,7 +56,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
{ {
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
printk("[<%08lx>] (%pS) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from); printk("[<%08lx>] (%ps) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from);
#else #else
printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
#endif #endif
......
...@@ -80,14 +80,14 @@ for_each_frame: tst frame, mask @ Check for address exceptions ...@@ -80,14 +80,14 @@ for_each_frame: tst frame, mask @ Check for address exceptions
ldr r1, [sv_pc, #-4] @ if stmfd sp!, {args} exists, ldr r1, [sv_pc, #-4] @ if stmfd sp!, {args} exists,
ldr r3, .Ldsi+4 ldr r3, .Ldsi+4
teq r3, r1, lsr #10 teq r3, r1, lsr #11
ldreq r0, [frame, #-8] @ get sp ldreq r0, [frame, #-8] @ get sp
subeq r0, r0, #4 @ point at the last arg subeq r0, r0, #4 @ point at the last arg
bleq .Ldumpstm @ dump saved registers bleq .Ldumpstm @ dump saved registers
1004: ldr r1, [sv_pc, #0] @ if stmfd sp!, {..., fp, ip, lr, pc} 1004: ldr r1, [sv_pc, #0] @ if stmfd sp!, {..., fp, ip, lr, pc}
ldr r3, .Ldsi @ instruction exists, ldr r3, .Ldsi @ instruction exists,
teq r3, r1, lsr #10 teq r3, r1, lsr #11
subeq r0, frame, #16 subeq r0, frame, #16
bleq .Ldumpstm @ dump saved registers bleq .Ldumpstm @ dump saved registers
...@@ -128,11 +128,11 @@ ENDPROC(c_backtrace) ...@@ -128,11 +128,11 @@ ENDPROC(c_backtrace)
beq 2f beq 2f
add r7, r7, #1 add r7, r7, #1
teq r7, #6 teq r7, #6
moveq r7, #1 moveq r7, #0
moveq r1, #'\n' adr r3, .Lcr
movne r1, #' ' addne r3, r3, #1 @ skip newline
ldr r3, [stack], #-4 ldr r2, [stack], #-4
mov r2, reg mov r1, reg
adr r0, .Lfp adr r0, .Lfp
bl printk bl printk
2: subs reg, reg, #1 2: subs reg, reg, #1
...@@ -142,11 +142,11 @@ ENDPROC(c_backtrace) ...@@ -142,11 +142,11 @@ ENDPROC(c_backtrace)
blne printk blne printk
ldmfd sp!, {instr, reg, stack, r7, pc} ldmfd sp!, {instr, reg, stack, r7, pc}
.Lfp: .asciz "%cr%d:%08x" .Lfp: .asciz " r%d:%08x%s"
.Lcr: .asciz "\n" .Lcr: .asciz "\n"
.Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n" .Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n"
.align .align
.Ldsi: .word 0xe92dd800 >> 10 @ stmfd sp!, {... fp, ip, lr, pc} .Ldsi: .word 0xe92dd800 >> 11 @ stmfd sp!, {... fp, ip, lr, pc}
.word 0xe92d0000 >> 10 @ stmfd sp!, {} .word 0xe92d0000 >> 11 @ stmfd sp!, {}
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment