2 * linux/arch/arm/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 * 27/03/03 Ian Molton Clean up CONFIG_CPU
13 #include <linux/config.h>
14 #include <linux/linkage.h>
15 #include <asm/assembler.h>
18 @ fp is 0 or stack frame
32 #if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK)
36 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
37 tst r1, #0x10 @ 26 or 32-bit?
38 moveq mask, #0xfc000003
44 ldmeqfd sp!, {r4 - r8, pc}
46 2: stmfd sp!, {pc} @ calculate offset of PC in STMIA instruction
51 3: tst frame, mask @ Check for address exceptions...
54 1001: ldr next, [frame, #-12] @ get fp
55 1002: ldr r2, [frame, #-4] @ get lr
56 1003: ldr r3, [frame, #0] @ get pc
57 sub save, r3, offset @ Correct PC for prefetching
59 1004: ldr r1, [save, #0] @ get instruction at function
66 bl dump_backtrace_entry
68 ldr r0, [frame, #-8] @ get sp
70 1005: ldr r1, [save, #4] @ get instruction at function+4
73 teq r3, r2 @ Check for stmia sp!, {args}
74 addeq save, save, #4 @ next instruction
78 1006: ldr r1, [save, #4] @ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
85 * A zero next framepointer means we're done.
88 ldmeqfd sp!, {r4 - r8, pc}
91 * The next framepointer must be above the
92 * current framepointer.
100 * Fixup for LDMDB. Note that this must not be in the fixup section.
105 ldmfd sp!, {r4 - r8, pc}
108 .section __ex_table,"a"
122 .Ldumpstm: stmfd sp!, {instr, reg, stack, r7, r8, lr}
128 tst instr, r3, lsl reg
145 ldmfd sp!, {instr, reg, stack, r7, r8, pc}
147 .Lfp: .asciz " r%d = %08X%c"
149 .Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n"
151 .Ldsi: .word 0x00e92dd8 >> 2
152 .word 0x00e92d00 >> 2