diff options
author | Laura Abbott <lauraa@codeaurora.org> | 2011-05-27 12:23:16 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-27 17:56:53 -0400 |
commit | 81479c246c07b703aeb4bf54933b7d928cb5b717 (patch) | |
tree | 2ad7888a68ad944292c455d2ee4fc242bcc79a5c /arch/arm/lib | |
parent | 45b95235b0ac86cef2ad4480b0618b8778847479 (diff) |
ARM: 6945/1: Add unwinding support for division functions
The software division functions never had unwinding annotations
added. Currently, when a division by zero occurs the backtrace shown
will stop at Ldiv0 or some completely unrelated function. Add
unwinding annotations in hopes of getting a more useful backtrace
when a division by zero occurs.
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Acked-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r-- | arch/arm/lib/lib1funcs.S | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S index 6dc06487f3c3..c562f649734c 100644 --- a/arch/arm/lib/lib1funcs.S +++ b/arch/arm/lib/lib1funcs.S | |||
@@ -35,7 +35,7 @@ Boston, MA 02111-1307, USA. */ | |||
35 | 35 | ||
36 | #include <linux/linkage.h> | 36 | #include <linux/linkage.h> |
37 | #include <asm/assembler.h> | 37 | #include <asm/assembler.h> |
38 | 38 | #include <asm/unwind.h> | |
39 | 39 | ||
40 | .macro ARM_DIV_BODY dividend, divisor, result, curbit | 40 | .macro ARM_DIV_BODY dividend, divisor, result, curbit |
41 | 41 | ||
@@ -207,6 +207,7 @@ Boston, MA 02111-1307, USA. */ | |||
207 | 207 | ||
208 | ENTRY(__udivsi3) | 208 | ENTRY(__udivsi3) |
209 | ENTRY(__aeabi_uidiv) | 209 | ENTRY(__aeabi_uidiv) |
210 | UNWIND(.fnstart) | ||
210 | 211 | ||
211 | subs r2, r1, #1 | 212 | subs r2, r1, #1 |
212 | moveq pc, lr | 213 | moveq pc, lr |
@@ -230,10 +231,12 @@ ENTRY(__aeabi_uidiv) | |||
230 | mov r0, r0, lsr r2 | 231 | mov r0, r0, lsr r2 |
231 | mov pc, lr | 232 | mov pc, lr |
232 | 233 | ||
234 | UNWIND(.fnend) | ||
233 | ENDPROC(__udivsi3) | 235 | ENDPROC(__udivsi3) |
234 | ENDPROC(__aeabi_uidiv) | 236 | ENDPROC(__aeabi_uidiv) |
235 | 237 | ||
236 | ENTRY(__umodsi3) | 238 | ENTRY(__umodsi3) |
239 | UNWIND(.fnstart) | ||
237 | 240 | ||
238 | subs r2, r1, #1 @ compare divisor with 1 | 241 | subs r2, r1, #1 @ compare divisor with 1 |
239 | bcc Ldiv0 | 242 | bcc Ldiv0 |
@@ -247,10 +250,12 @@ ENTRY(__umodsi3) | |||
247 | 250 | ||
248 | mov pc, lr | 251 | mov pc, lr |
249 | 252 | ||
253 | UNWIND(.fnend) | ||
250 | ENDPROC(__umodsi3) | 254 | ENDPROC(__umodsi3) |
251 | 255 | ||
252 | ENTRY(__divsi3) | 256 | ENTRY(__divsi3) |
253 | ENTRY(__aeabi_idiv) | 257 | ENTRY(__aeabi_idiv) |
258 | UNWIND(.fnstart) | ||
254 | 259 | ||
255 | cmp r1, #0 | 260 | cmp r1, #0 |
256 | eor ip, r0, r1 @ save the sign of the result. | 261 | eor ip, r0, r1 @ save the sign of the result. |
@@ -287,10 +292,12 @@ ENTRY(__aeabi_idiv) | |||
287 | rsbmi r0, r0, #0 | 292 | rsbmi r0, r0, #0 |
288 | mov pc, lr | 293 | mov pc, lr |
289 | 294 | ||
295 | UNWIND(.fnend) | ||
290 | ENDPROC(__divsi3) | 296 | ENDPROC(__divsi3) |
291 | ENDPROC(__aeabi_idiv) | 297 | ENDPROC(__aeabi_idiv) |
292 | 298 | ||
293 | ENTRY(__modsi3) | 299 | ENTRY(__modsi3) |
300 | UNWIND(.fnstart) | ||
294 | 301 | ||
295 | cmp r1, #0 | 302 | cmp r1, #0 |
296 | beq Ldiv0 | 303 | beq Ldiv0 |
@@ -310,11 +317,14 @@ ENTRY(__modsi3) | |||
310 | rsbmi r0, r0, #0 | 317 | rsbmi r0, r0, #0 |
311 | mov pc, lr | 318 | mov pc, lr |
312 | 319 | ||
320 | UNWIND(.fnend) | ||
313 | ENDPROC(__modsi3) | 321 | ENDPROC(__modsi3) |
314 | 322 | ||
315 | #ifdef CONFIG_AEABI | 323 | #ifdef CONFIG_AEABI |
316 | 324 | ||
317 | ENTRY(__aeabi_uidivmod) | 325 | ENTRY(__aeabi_uidivmod) |
326 | UNWIND(.fnstart) | ||
327 | UNWIND(.save {r0, r1, ip, lr} ) | ||
318 | 328 | ||
319 | stmfd sp!, {r0, r1, ip, lr} | 329 | stmfd sp!, {r0, r1, ip, lr} |
320 | bl __aeabi_uidiv | 330 | bl __aeabi_uidiv |
@@ -323,10 +333,12 @@ ENTRY(__aeabi_uidivmod) | |||
323 | sub r1, r1, r3 | 333 | sub r1, r1, r3 |
324 | mov pc, lr | 334 | mov pc, lr |
325 | 335 | ||
336 | UNWIND(.fnend) | ||
326 | ENDPROC(__aeabi_uidivmod) | 337 | ENDPROC(__aeabi_uidivmod) |
327 | 338 | ||
328 | ENTRY(__aeabi_idivmod) | 339 | ENTRY(__aeabi_idivmod) |
329 | 340 | UNWIND(.fnstart) | |
341 | UNWIND(.save {r0, r1, ip, lr} ) | ||
330 | stmfd sp!, {r0, r1, ip, lr} | 342 | stmfd sp!, {r0, r1, ip, lr} |
331 | bl __aeabi_idiv | 343 | bl __aeabi_idiv |
332 | ldmfd sp!, {r1, r2, ip, lr} | 344 | ldmfd sp!, {r1, r2, ip, lr} |
@@ -334,15 +346,18 @@ ENTRY(__aeabi_idivmod) | |||
334 | sub r1, r1, r3 | 346 | sub r1, r1, r3 |
335 | mov pc, lr | 347 | mov pc, lr |
336 | 348 | ||
349 | UNWIND(.fnend) | ||
337 | ENDPROC(__aeabi_idivmod) | 350 | ENDPROC(__aeabi_idivmod) |
338 | 351 | ||
339 | #endif | 352 | #endif |
340 | 353 | ||
341 | Ldiv0: | 354 | Ldiv0: |
342 | 355 | UNWIND(.fnstart) | |
356 | UNWIND(.pad #4) | ||
357 | UNWIND(.save {lr}) | ||
343 | str lr, [sp, #-8]! | 358 | str lr, [sp, #-8]! |
344 | bl __div0 | 359 | bl __div0 |
345 | mov r0, #0 @ About as wrong as it could be. | 360 | mov r0, #0 @ About as wrong as it could be. |
346 | ldr pc, [sp], #8 | 361 | ldr pc, [sp], #8 |
347 | 362 | UNWIND(.fnend) | |
348 | 363 | ENDPROC(Ldiv0) | |