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/config.h>
11 #include <linux/linkage.h>
12 #include <asm/assembler.h>
15 @ fp is 0 or stack frame
29 #ifdef CONFIG_NO_FRAME_POINTER
33 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
39 LOADREGS(eqfd, sp!, {r4 - r8, pc})
41 2: stmfd sp!, {pc} @ calculate offset of PC in STMIA instruction
46 3: tst frame, mask @ Check for address exceptions...
49 1001: ldr next, [frame, #-12] @ get fp
50 1002: ldr r2, [frame, #-4] @ get lr
51 1003: ldr r3, [frame, #0] @ get pc
52 sub save, r3, offset @ Correct PC for prefetching
54 1004: ldr r1, [save, #0] @ get instruction at function
62 bl printk @ print pc and link register
64 ldr r0, [frame, #-8] @ get sp
66 1005: ldr r1, [save, #4] @ get instruction at function+4
69 teq r3, r2 @ Check for stmia sp!, {args}
70 addeq save, save, #4 @ next instruction
74 1006: ldr r1, [save, #4] @ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
84 LOADREGS(fd, sp!, {r4 - r8, pc})
94 LOADREGS(fd, sp!, {r4 - r8, pc})
98 .section __ex_table,"a"
112 .Ldumpstm: stmfd sp!, {instr, reg, stack, r7, lr}
118 tst instr, r3, lsl reg
135 LOADREGS(fd, sp!, {instr, reg, stack, r7, pc})
137 .Lfe: .asciz "Function entered at [<%p>] from [<%p>]\n"
138 .Lfp: .asciz " r%d = %08X%c"
140 .Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n"
142 .Ldsi: .word 0x00e92dd8 >> 2
143 .word 0x00e92d00 >> 2