Commit c2459d35 authored by Lin Yongting's avatar Lin Yongting Committed by Russell King

ARM: 8204/1: Add unwinding support for memset function

The memset function never had unwinding annotations added.
Currently, when accessing NULL pointer by memset occurs the
backtrace shown will stop at memset or some completely unrelated
function. Add unwinding annotations in hopes of getting a more
useful backtrace when accessing NULL pointer by memset, kprobe
or interrupt.
Signed-off-by: default avatarLin Yongting <linyongting@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a391263c
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/assembler.h> #include <asm/assembler.h>
#include <asm/unwind.h>
.text .text
.align 5 .align 5
ENTRY(memset) ENTRY(memset)
UNWIND( .fnstart )
ands r3, r0, #3 @ 1 unaligned? ands r3, r0, #3 @ 1 unaligned?
mov ip, r0 @ preserve r0 as return value mov ip, r0 @ preserve r0 as return value
bne 6f @ 1 bne 6f @ 1
...@@ -34,6 +36,9 @@ ENTRY(memset) ...@@ -34,6 +36,9 @@ ENTRY(memset)
* We need 2 extra registers for this loop - use r8 and the LR * We need 2 extra registers for this loop - use r8 and the LR
*/ */
stmfd sp!, {r8, lr} stmfd sp!, {r8, lr}
UNWIND( .fnend )
UNWIND( .fnstart )
UNWIND( .save {r8, lr} )
mov r8, r1 mov r8, r1
mov lr, r1 mov lr, r1
...@@ -53,6 +58,7 @@ ENTRY(memset) ...@@ -53,6 +58,7 @@ ENTRY(memset)
tst r2, #16 tst r2, #16
stmneia ip!, {r1, r3, r8, lr} stmneia ip!, {r1, r3, r8, lr}
ldmfd sp!, {r8, lr} ldmfd sp!, {r8, lr}
UNWIND( .fnend )
#else #else
...@@ -62,6 +68,9 @@ ENTRY(memset) ...@@ -62,6 +68,9 @@ ENTRY(memset)
*/ */
stmfd sp!, {r4-r8, lr} stmfd sp!, {r4-r8, lr}
UNWIND( .fnend )
UNWIND( .fnstart )
UNWIND( .save {r4-r8, lr} )
mov r4, r1 mov r4, r1
mov r5, r1 mov r5, r1
mov r6, r1 mov r6, r1
...@@ -94,9 +103,11 @@ ENTRY(memset) ...@@ -94,9 +103,11 @@ ENTRY(memset)
tst r2, #16 tst r2, #16
stmneia ip!, {r4-r7} stmneia ip!, {r4-r7}
ldmfd sp!, {r4-r8, lr} ldmfd sp!, {r4-r8, lr}
UNWIND( .fnend )
#endif #endif
UNWIND( .fnstart )
4: tst r2, #8 4: tst r2, #8
stmneia ip!, {r1, r3} stmneia ip!, {r1, r3}
tst r2, #4 tst r2, #4
...@@ -120,4 +131,5 @@ ENTRY(memset) ...@@ -120,4 +131,5 @@ ENTRY(memset)
strb r1, [ip], #1 @ 1 strb r1, [ip], #1 @ 1
add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
b 1b b 1b
UNWIND( .fnend )
ENDPROC(memset) ENDPROC(memset)
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