diff options
author | Lin Yongting <linyongting@gmail.com> | 2014-11-15 21:14:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-11-21 10:24:49 -0500 |
commit | c2459d35f5b8de077fde859b8c96a23f309b9ab2 (patch) | |
tree | 7ee1b10de74cc045af8eea51d676a473ac59db7b /arch/arm/lib/memset.S | |
parent | a391263cd84e6ae2da26a54383f3abf80c18d9df (diff) |
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: Lin Yongting <linyongting@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib/memset.S')
-rw-r--r-- | arch/arm/lib/memset.S | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S index 671455c854fa..a4ee97b5a2bf 100644 --- a/arch/arm/lib/memset.S +++ b/arch/arm/lib/memset.S | |||
@@ -11,11 +11,13 @@ | |||
11 | */ | 11 | */ |
12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
13 | #include <asm/assembler.h> | 13 | #include <asm/assembler.h> |
14 | #include <asm/unwind.h> | ||
14 | 15 | ||
15 | .text | 16 | .text |
16 | .align 5 | 17 | .align 5 |
17 | 18 | ||
18 | ENTRY(memset) | 19 | ENTRY(memset) |
20 | UNWIND( .fnstart ) | ||
19 | ands r3, r0, #3 @ 1 unaligned? | 21 | ands r3, r0, #3 @ 1 unaligned? |
20 | mov ip, r0 @ preserve r0 as return value | 22 | mov ip, r0 @ preserve r0 as return value |
21 | bne 6f @ 1 | 23 | bne 6f @ 1 |
@@ -34,6 +36,9 @@ ENTRY(memset) | |||
34 | * We need 2 extra registers for this loop - use r8 and the LR | 36 | * We need 2 extra registers for this loop - use r8 and the LR |
35 | */ | 37 | */ |
36 | stmfd sp!, {r8, lr} | 38 | stmfd sp!, {r8, lr} |
39 | UNWIND( .fnend ) | ||
40 | UNWIND( .fnstart ) | ||
41 | UNWIND( .save {r8, lr} ) | ||
37 | mov r8, r1 | 42 | mov r8, r1 |
38 | mov lr, r1 | 43 | mov lr, r1 |
39 | 44 | ||
@@ -53,6 +58,7 @@ ENTRY(memset) | |||
53 | tst r2, #16 | 58 | tst r2, #16 |
54 | stmneia ip!, {r1, r3, r8, lr} | 59 | stmneia ip!, {r1, r3, r8, lr} |
55 | ldmfd sp!, {r8, lr} | 60 | ldmfd sp!, {r8, lr} |
61 | UNWIND( .fnend ) | ||
56 | 62 | ||
57 | #else | 63 | #else |
58 | 64 | ||
@@ -62,6 +68,9 @@ ENTRY(memset) | |||
62 | */ | 68 | */ |
63 | 69 | ||
64 | stmfd sp!, {r4-r8, lr} | 70 | stmfd sp!, {r4-r8, lr} |
71 | UNWIND( .fnend ) | ||
72 | UNWIND( .fnstart ) | ||
73 | UNWIND( .save {r4-r8, lr} ) | ||
65 | mov r4, r1 | 74 | mov r4, r1 |
66 | mov r5, r1 | 75 | mov r5, r1 |
67 | mov r6, r1 | 76 | mov r6, r1 |
@@ -94,9 +103,11 @@ ENTRY(memset) | |||
94 | tst r2, #16 | 103 | tst r2, #16 |
95 | stmneia ip!, {r4-r7} | 104 | stmneia ip!, {r4-r7} |
96 | ldmfd sp!, {r4-r8, lr} | 105 | ldmfd sp!, {r4-r8, lr} |
106 | UNWIND( .fnend ) | ||
97 | 107 | ||
98 | #endif | 108 | #endif |
99 | 109 | ||
110 | UNWIND( .fnstart ) | ||
100 | 4: tst r2, #8 | 111 | 4: tst r2, #8 |
101 | stmneia ip!, {r1, r3} | 112 | stmneia ip!, {r1, r3} |
102 | tst r2, #4 | 113 | tst r2, #4 |
@@ -120,4 +131,5 @@ ENTRY(memset) | |||
120 | strb r1, [ip], #1 @ 1 | 131 | strb r1, [ip], #1 @ 1 |
121 | add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) | 132 | add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) |
122 | b 1b | 133 | b 1b |
134 | UNWIND( .fnend ) | ||
123 | ENDPROC(memset) | 135 | ENDPROC(memset) |