summaryrefslogtreecommitdiffstats
path: root/libc/arch-arm
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-07-16 15:31:39 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-07-16 15:31:39 -0700
commit2a18ea1462cf65cc51bfcb1a1c46972ee5af1d01 (patch)
treebd4a9bb4ef5c4280de5bcec3761a240c9353f02b /libc/arch-arm
parent5148661f8d2be514d0e3c191bc1e489157ae1154 (diff)
parentf152e386fcf477f3f5de9dc020c3660d4f9c4b81 (diff)
downloadbionic-2a18ea1462cf65cc51bfcb1a1c46972ee5af1d01.zip
bionic-2a18ea1462cf65cc51bfcb1a1c46972ee5af1d01.tar.gz
bionic-2a18ea1462cf65cc51bfcb1a1c46972ee5af1d01.tar.bz2
am f152e386: Merge "EABI syscall cleanup."
* commit 'f152e386fcf477f3f5de9dc020c3660d4f9c4b81': EABI syscall cleanup.
Diffstat (limited to 'libc/arch-arm')
-rw-r--r--libc/arch-arm/bionic/clone.S18
-rw-r--r--libc/arch-arm/bionic/futex_arm.S15
2 files changed, 15 insertions, 18 deletions
diff --git a/libc/arch-arm/bionic/clone.S b/libc/arch-arm/bionic/clone.S
index 01eb966..d00b6a6 100644
--- a/libc/arch-arm/bionic/clone.S
+++ b/libc/arch-arm/bionic/clone.S
@@ -32,33 +32,33 @@
// int __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
ENTRY(__pthread_clone)
- # Copy the args onto the new stack.
+ # Push 'fn' and 'arg' onto 'child_stack'.
stmdb r1!, {r0, r3}
# The sys_clone system call only takes two arguments: 'flags' and 'child_stack'.
# 'child_stack' is already in r1, but we need to move 'flags' into position.
mov r0, r2
- stmfd sp!, {r4, r7}
# System call.
+ mov ip, r7
ldr r7, =__NR_clone
swi #0
+
+ # Child?
movs r0, r0
beq 1f
- # In parent, reload saved registers then either return or set errno.
- ldmfd sp!, {r4, r7}
+ # Parent.
+ mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-1: # The child.
- # pick the function arg and call address off the stack and jump
- # to the C __thread_entry function which does some setup and then
- # calls the thread's start function
+1: # Child.
+ # Pop 'fn' and 'arg' back off the stack and call __thread_entry.
pop {r0, r1}
- # __thread_entry needs the TLS pointer
+ # __thread_entry also needs our stack pointer.
mov r2, sp
b __thread_entry
END(__pthread_clone)
diff --git a/libc/arch-arm/bionic/futex_arm.S b/libc/arch-arm/bionic/futex_arm.S
index e21a385..4131cdb 100644
--- a/libc/arch-arm/bionic/futex_arm.S
+++ b/libc/arch-arm/bionic/futex_arm.S
@@ -34,11 +34,10 @@
// __futex_syscall3(*ftx, op, val)
ENTRY(__futex_syscall3)
- stmdb sp!, {r4, r7}
- .save {r4, r7}
+ mov ip, r7
ldr r7, =__NR_futex
swi #0
- ldmia sp!, {r4, r7}
+ mov r7, ip
bx lr
END(__futex_syscall3)
@@ -49,25 +48,23 @@ END(__futex_syscall4)
// __futex_wait(*ftx, val, *timespec)
ENTRY(__futex_wait)
- stmdb sp!, {r4, r7}
- .save {r4, r7}
+ mov ip, r7
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
ldr r7, =__NR_futex
swi #0
- ldmia sp!, {r4, r7}
+ mov r7, ip
bx lr
END(__futex_wait)
// __futex_wake(*ftx, counter)
ENTRY(__futex_wake)
- .save {r4, r7}
- stmdb sp!, {r4, r7}
+ mov ip, r7
mov r2, r1
mov r1, #FUTEX_WAKE
ldr r7, =__NR_futex
swi #0
- ldmia sp!, {r4, r7}
+ mov r7, ip
bx lr
END(__futex_wake)