aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/lib
diff options
context:
space:
mode:
authorLin Yongting <linyongting@gmail.com>2014-11-26 08:36:15 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-11-27 11:00:24 -0500
commit207a6cb06990c298d0eac982e053d370e216d93d (patch)
tree21c8e4958b21b05d35a2daad7f8b0cd8f4b627d6 /arch/arm/lib
parent20cb6abfe0062693183eb2a85f7c73792e96407f (diff)
ARM: 8224/1: Add unwinding support for memmove function
The memmove function never had unwinding annotations added. Currently, when accessing invalid pointer by memmove occurs the backtrace shown will stop at memmove or some completely unrelated function. Add unwinding annotations in hopes of getting a more useful backtrace in following cases: 1. die on accessing invalid pointer by memmove 2. kprobe trapped at any instruction within memmove 3. interrupted at any instruction within memmove 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')
-rw-r--r--arch/arm/lib/memmove.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index d1fc0c0c342c..69a9d47fc5ab 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -12,6 +12,7 @@
12 12
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <asm/unwind.h>
15 16
16 .text 17 .text
17 18
@@ -27,12 +28,17 @@
27 */ 28 */
28 29
29ENTRY(memmove) 30ENTRY(memmove)
31 UNWIND( .fnstart )
30 32
31 subs ip, r0, r1 33 subs ip, r0, r1
32 cmphi r2, ip 34 cmphi r2, ip
33 bls memcpy 35 bls memcpy
34 36
35 stmfd sp!, {r0, r4, lr} 37 stmfd sp!, {r0, r4, lr}
38 UNWIND( .fnend )
39
40 UNWIND( .fnstart )
41 UNWIND( .save {r0, r4, lr} ) @ in first stmfd block
36 add r1, r1, r2 42 add r1, r1, r2
37 add r0, r0, r2 43 add r0, r0, r2
38 subs r2, r2, #4 44 subs r2, r2, #4
@@ -45,6 +51,11 @@ ENTRY(memmove)
45 51
461: subs r2, r2, #(28) 521: subs r2, r2, #(28)
47 stmfd sp!, {r5 - r8} 53 stmfd sp!, {r5 - r8}
54 UNWIND( .fnend )
55
56 UNWIND( .fnstart )
57 UNWIND( .save {r0, r4, lr} )
58 UNWIND( .save {r5 - r8} ) @ in second stmfd block
48 blt 5f 59 blt 5f
49 60
50 CALGN( ands ip, r0, #31 ) 61 CALGN( ands ip, r0, #31 )
@@ -97,6 +108,10 @@ ENTRY(memmove)
97 CALGN( bcs 2b ) 108 CALGN( bcs 2b )
98 109
997: ldmfd sp!, {r5 - r8} 1107: ldmfd sp!, {r5 - r8}
111 UNWIND( .fnend ) @ end of second stmfd block
112
113 UNWIND( .fnstart )
114 UNWIND( .save {r0, r4, lr} ) @ still in first stmfd block
100 115
1018: movs r2, r2, lsl #31 1168: movs r2, r2, lsl #31
102 ldrneb r3, [r1, #-1]! 117 ldrneb r3, [r1, #-1]!
@@ -124,10 +139,13 @@ ENTRY(memmove)
124 ldr r3, [r1, #0] 139 ldr r3, [r1, #0]
125 beq 17f 140 beq 17f
126 blt 18f 141 blt 18f
142 UNWIND( .fnend )
127 143
128 144
129 .macro backward_copy_shift push pull 145 .macro backward_copy_shift push pull
130 146
147 UNWIND( .fnstart )
148 UNWIND( .save {r0, r4, lr} ) @ still in first stmfd block
131 subs r2, r2, #28 149 subs r2, r2, #28
132 blt 14f 150 blt 14f
133 151
@@ -137,6 +155,11 @@ ENTRY(memmove)
137 CALGN( bcc 15f ) 155 CALGN( bcc 15f )
138 156
13911: stmfd sp!, {r5 - r9} 15711: stmfd sp!, {r5 - r9}
158 UNWIND( .fnend )
159
160 UNWIND( .fnstart )
161 UNWIND( .save {r0, r4, lr} )
162 UNWIND( .save {r5 - r9} ) @ in new second stmfd block
140 163
141 PLD( pld [r1, #-4] ) 164 PLD( pld [r1, #-4] )
142 PLD( subs r2, r2, #96 ) 165 PLD( subs r2, r2, #96 )
@@ -171,6 +194,10 @@ ENTRY(memmove)
171 PLD( bge 13b ) 194 PLD( bge 13b )
172 195
173 ldmfd sp!, {r5 - r9} 196 ldmfd sp!, {r5 - r9}
197 UNWIND( .fnend ) @ end of the second stmfd block
198
199 UNWIND( .fnstart )
200 UNWIND( .save {r0, r4, lr} ) @ still in first stmfd block
174 201
17514: ands ip, r2, #28 20214: ands ip, r2, #28
176 beq 16f 203 beq 16f
@@ -186,6 +213,7 @@ ENTRY(memmove)
186 213
18716: add r1, r1, #(\pull / 8) 21416: add r1, r1, #(\pull / 8)
188 b 8b 215 b 8b
216 UNWIND( .fnend )
189 217
190 .endm 218 .endm
191 219