patch-2.4.14 linux/arch/arm/lib/backtrace.S

Next file: linux/arch/arm/lib/io-acorn.S
Previous file: linux/arch/arm/kernel/entry-armv.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.13/linux/arch/arm/lib/backtrace.S linux/arch/arm/lib/backtrace.S
@@ -44,33 +44,33 @@
 1:		moveq	r0, #-2
 		LOADREGS(eqfd, sp!, {r4 - r8, pc})
 
-2:		stmfd	sp!, {pc}			@ calculate offset of PC in STMIA instruction
+2:		stmfd	sp!, {pc}		@ calculate offset of PC in STMIA instruction
 		ldr	r0, [sp], #4
 		adr	r1, 2b - 4
 		sub	offset, r0, r1
 
-3:		tst	frame, mask			@ Check for address exceptions...
+3:		tst	frame, mask		@ Check for address exceptions...
 		bne	1b
 
-		ldmda	frame, {r0, r1, r2, r3}		@ fp, sp, lr, pc
+1001:		ldmda	frame, {r0, r1, r2, r3}	@ fp, sp, lr, pc
 		mov	next, r0
 
-		sub	save, r3, offset		@ Correct PC for prefetching
+		sub	save, r3, offset	@ Correct PC for prefetching
 		bic	save, save, mask
 		adr	r0, .Lfe
 		mov	r1, save
 		bic	r2, r2, mask
-		bl	SYMBOL_NAME(printk)
+		bl	SYMBOL_NAME(printk)	@ print pc and link register
 
 		sub	r0, frame, #16
-		ldr	r1, [save, #4]
+1002:		ldr	r1, [save, #4]		@ get instruction at function+4
 		mov	r3, r1, lsr #10
 		ldr	r2, .Ldsi+4
 		teq	r3, r2			@ Check for stmia sp!, {args}
 		addeq	save, save, #4		@ next instruction
 		bleq	.Ldumpstm
 
-		ldr	r1, [save, #4]		@ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
+1003:		ldr	r1, [save, #4]		@ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
 		mov	r3, r1, lsr #10
 		ldr	r2, .Ldsi
 		teq	r3, r2
@@ -82,6 +82,24 @@
 		bne	3b
 		LOADREGS(fd, sp!, {r4 - r8, pc})
 
+/*
+ * Fixup for LDMDB
+ */
+		.section .fixup,"ax"
+		.align	0
+1004:		ldr	r0, =.Lbad
+		mov	r1, frame
+		bl	SYMBOL_NAME(printk)
+		LOADREGS(fd, sp!, {r4 - r8, pc})
+		.ltorg
+		.previous
+		
+		.section __ex_table,"a"
+		.align	3
+		.long	1001b, 1004b
+		.long	1002b, 1004b
+		.long	1003b, 1004b
+		.previous
 
 #define instr r4
 #define reg   r5
@@ -115,6 +133,7 @@
 .Lfe:		.asciz	"Function entered at [<%p>] from [<%p>]\n"
 .Lfp:		.asciz	" r%d = %08X%c"
 .Lcr:		.asciz	"\n"
+.Lbad:		.asciz	"Backtrace aborted due to bad frame pointer <%p>\n"
 		.align
 .Ldsi:		.word	0x00e92dd8 >> 2
 		.word	0x00e92d00 >> 2

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)