2 * linux/arch/arm26/lib/backtrace.S
4 * Copyright (C) 1995, 1996 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 #include <linux/linkage.h>
11 #include <asm/assembler.h>
14 @ fp is 0 or stack frame
28 #ifdef CONFIG_NO_FRAME_POINTER
32 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
38 LOADREGS(eqfd, sp!, {r4 - r8, pc})
40 2: stmfd sp!, {pc} @ calculate offset of PC in STMIA instruction
45 3: tst frame, mask @ Check for address exceptions...
48 1001: ldr next, [frame, #-12] @ get fp
49 1002: ldr r2, [frame, #-4] @ get lr
50 1003: ldr r3, [frame, #0] @ get pc
51 sub save, r3, offset @ Correct PC for prefetching
53 1004: ldr r1, [save, #0] @ get instruction at function
61 bl printk @ print pc and link register
63 ldr r0, [frame, #-8] @ get sp
65 1005: ldr r1, [save, #4] @ get instruction at function+4
68 teq r3, r2 @ Check for stmia sp!, {args}
69 addeq save, save, #4 @ next instruction
73 1006: ldr r1, [save, #4] @ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
83 LOADREGS(fd, sp!, {r4 - r8, pc})
93 LOADREGS(fd, sp!, {r4 - r8, pc})
97 .section __ex_table,"a"
111 .Ldumpstm: stmfd sp!, {instr, reg, stack, r7, lr}
117 tst instr, r3, lsl reg
134 LOADREGS(fd, sp!, {instr, reg, stack, r7, pc})
136 .Lfe: .asciz "Function entered at [<%p>] from [<%p>]\n"
137 .Lfp: .asciz " r%d = %08X%c"
139 .Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n"
141 .Ldsi: .word 0x00e92dd8 >> 2
142 .word 0x00e92d00 >> 2