summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2009-09-15 13:41:14 -0700
committerBen Cheng <bccheng@google.com>2009-09-15 13:41:14 -0700
commitbd192b470b69e00e9313680b70c5572a609e535d (patch)
tree61d3575f3195acab886e3fe74388ff45b76fb539
parent824201294b5f3c3ad6ca9d9751d96f78142c5409 (diff)
downloadbionic-bd192b470b69e00e9313680b70c5572a609e535d.zip
bionic-bd192b470b69e00e9313680b70c5572a609e535d.tar.gz
bionic-bd192b470b69e00e9313680b70c5572a609e535d.tar.bz2
Add stack unwinding directives to assembly leaf functions.
So that the real culprit of native crashes can surface in the stack trace.
-rw-r--r--libc/arch-arm/bionic/atomics_arm.S9
-rw-r--r--libc/arch-arm/bionic/memcmp.S3
-rw-r--r--libc/arch-arm/bionic/memcmp16.S3
-rw-r--r--libc/arch-arm/bionic/memcpy.S2
4 files changed, 17 insertions, 0 deletions
diff --git a/libc/arch-arm/bionic/atomics_arm.S b/libc/arch-arm/bionic/atomics_arm.S
index b2da09f..f8b23e6 100644
--- a/libc/arch-arm/bionic/atomics_arm.S
+++ b/libc/arch-arm/bionic/atomics_arm.S
@@ -41,6 +41,8 @@
.equ kernel_cmpxchg, 0xFFFF0FC0
.equ kernel_atomic_base, 0xFFFF0FFF
__atomic_dec:
+ .fnstart
+ .save {r4, lr}
stmdb sp!, {r4, lr}
mov r2, r0
1: @ atomic_dec
@@ -53,8 +55,11 @@ __atomic_dec:
add r0, r1, #1
ldmia sp!, {r4, lr}
bx lr
+ .fnend
__atomic_inc:
+ .fnstart
+ .save {r4, lr}
stmdb sp!, {r4, lr}
mov r2, r0
1: @ atomic_inc
@@ -67,9 +72,12 @@ __atomic_inc:
sub r0, r1, #1
ldmia sp!, {r4, lr}
bx lr
+ .fnend
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
__atomic_cmpxchg:
+ .fnstart
+ .save {r4, lr}
stmdb sp!, {r4, lr}
mov r4, r0 /* r4 = save oldvalue */
1: @ atomic_cmpxchg
@@ -84,6 +92,7 @@ __atomic_cmpxchg:
2: @ atomic_cmpxchg
ldmia sp!, {r4, lr}
bx lr
+ .fnend
#else
#define KUSER_CMPXCHG 0xffffffc0
diff --git a/libc/arch-arm/bionic/memcmp.S b/libc/arch-arm/bionic/memcmp.S
index f45b56b..67dcddc 100644
--- a/libc/arch-arm/bionic/memcmp.S
+++ b/libc/arch-arm/bionic/memcmp.S
@@ -44,6 +44,7 @@
*/
memcmp:
+ .fnstart
PLD (r0, #0)
PLD (r1, #0)
@@ -53,6 +54,7 @@ memcmp:
moveq r0, #0
bxeq lr
+ .save {r4, lr}
/* save registers */
stmfd sp!, {r4, lr}
@@ -174,6 +176,7 @@ memcmp:
9: /* restore registers and return */
ldmfd sp!, {r4, lr}
bx lr
+ .fnend
diff --git a/libc/arch-arm/bionic/memcmp16.S b/libc/arch-arm/bionic/memcmp16.S
index 38d8b62..f398588 100644
--- a/libc/arch-arm/bionic/memcmp16.S
+++ b/libc/arch-arm/bionic/memcmp16.S
@@ -44,6 +44,7 @@
*/
__memcmp16:
+ .fnstart
PLD (r0, #0)
PLD (r1, #0)
@@ -79,6 +80,7 @@ __memcmp16:
bx lr
+ .save {r4, lr}
/* save registers */
0: stmfd sp!, {r4, lr}
@@ -93,6 +95,7 @@ __memcmp16:
/* restore registers and return */
ldmnefd sp!, {r4, lr}
bxne lr
+ .fnend
diff --git a/libc/arch-arm/bionic/memcpy.S b/libc/arch-arm/bionic/memcpy.S
index 97331d3..4ea2c6d 100644
--- a/libc/arch-arm/bionic/memcpy.S
+++ b/libc/arch-arm/bionic/memcpy.S
@@ -40,6 +40,7 @@
#define NEON_MAX_PREFETCH_DISTANCE 320
memcpy:
+ .fnstart
mov ip, r0
cmp r2, #16
blt 4f @ Have less than 16 bytes to copy
@@ -128,6 +129,7 @@ memcpy:
ldrmib r3, [r1], #1
strmib r3, [ip], #1
bx lr
+ .fnend
#else /* __ARM_ARCH__ < 7 */