am f152e386
: Merge "EABI syscall cleanup."
* commit 'f152e386fcf477f3f5de9dc020c3660d4f9c4b81': EABI syscall cleanup.
This commit is contained in:
commit
2a18ea1462
2 changed files with 15 additions and 18 deletions
|
@ -32,33 +32,33 @@
|
||||||
|
|
||||||
// int __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
|
// int __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
|
||||||
ENTRY(__pthread_clone)
|
ENTRY(__pthread_clone)
|
||||||
# Copy the args onto the new stack.
|
# Push 'fn' and 'arg' onto 'child_stack'.
|
||||||
stmdb r1!, {r0, r3}
|
stmdb r1!, {r0, r3}
|
||||||
|
|
||||||
# The sys_clone system call only takes two arguments: 'flags' and 'child_stack'.
|
# 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.
|
# 'child_stack' is already in r1, but we need to move 'flags' into position.
|
||||||
mov r0, r2
|
mov r0, r2
|
||||||
stmfd sp!, {r4, r7}
|
|
||||||
|
|
||||||
# System call.
|
# System call.
|
||||||
|
mov ip, r7
|
||||||
ldr r7, =__NR_clone
|
ldr r7, =__NR_clone
|
||||||
swi #0
|
swi #0
|
||||||
|
|
||||||
|
# Child?
|
||||||
movs r0, r0
|
movs r0, r0
|
||||||
beq 1f
|
beq 1f
|
||||||
|
|
||||||
# In parent, reload saved registers then either return or set errno.
|
# Parent.
|
||||||
ldmfd sp!, {r4, r7}
|
mov r7, ip
|
||||||
cmn r0, #(MAX_ERRNO + 1)
|
cmn r0, #(MAX_ERRNO + 1)
|
||||||
bxls lr
|
bxls lr
|
||||||
neg r0, r0
|
neg r0, r0
|
||||||
b __set_errno
|
b __set_errno
|
||||||
|
|
||||||
1: # The child.
|
1: # Child.
|
||||||
# pick the function arg and call address off the stack and jump
|
# Pop 'fn' and 'arg' back off the stack and call __thread_entry.
|
||||||
# to the C __thread_entry function which does some setup and then
|
|
||||||
# calls the thread's start function
|
|
||||||
pop {r0, r1}
|
pop {r0, r1}
|
||||||
# __thread_entry needs the TLS pointer
|
# __thread_entry also needs our stack pointer.
|
||||||
mov r2, sp
|
mov r2, sp
|
||||||
b __thread_entry
|
b __thread_entry
|
||||||
END(__pthread_clone)
|
END(__pthread_clone)
|
||||||
|
|
|
@ -34,11 +34,10 @@
|
||||||
|
|
||||||
// __futex_syscall3(*ftx, op, val)
|
// __futex_syscall3(*ftx, op, val)
|
||||||
ENTRY(__futex_syscall3)
|
ENTRY(__futex_syscall3)
|
||||||
stmdb sp!, {r4, r7}
|
mov ip, r7
|
||||||
.save {r4, r7}
|
|
||||||
ldr r7, =__NR_futex
|
ldr r7, =__NR_futex
|
||||||
swi #0
|
swi #0
|
||||||
ldmia sp!, {r4, r7}
|
mov r7, ip
|
||||||
bx lr
|
bx lr
|
||||||
END(__futex_syscall3)
|
END(__futex_syscall3)
|
||||||
|
|
||||||
|
@ -49,25 +48,23 @@ END(__futex_syscall4)
|
||||||
|
|
||||||
// __futex_wait(*ftx, val, *timespec)
|
// __futex_wait(*ftx, val, *timespec)
|
||||||
ENTRY(__futex_wait)
|
ENTRY(__futex_wait)
|
||||||
stmdb sp!, {r4, r7}
|
mov ip, r7
|
||||||
.save {r4, r7}
|
|
||||||
mov r3, r2
|
mov r3, r2
|
||||||
mov r2, r1
|
mov r2, r1
|
||||||
mov r1, #FUTEX_WAIT
|
mov r1, #FUTEX_WAIT
|
||||||
ldr r7, =__NR_futex
|
ldr r7, =__NR_futex
|
||||||
swi #0
|
swi #0
|
||||||
ldmia sp!, {r4, r7}
|
mov r7, ip
|
||||||
bx lr
|
bx lr
|
||||||
END(__futex_wait)
|
END(__futex_wait)
|
||||||
|
|
||||||
// __futex_wake(*ftx, counter)
|
// __futex_wake(*ftx, counter)
|
||||||
ENTRY(__futex_wake)
|
ENTRY(__futex_wake)
|
||||||
.save {r4, r7}
|
mov ip, r7
|
||||||
stmdb sp!, {r4, r7}
|
|
||||||
mov r2, r1
|
mov r2, r1
|
||||||
mov r1, #FUTEX_WAKE
|
mov r1, #FUTEX_WAKE
|
||||||
ldr r7, =__NR_futex
|
ldr r7, =__NR_futex
|
||||||
swi #0
|
swi #0
|
||||||
ldmia sp!, {r4, r7}
|
mov r7, ip
|
||||||
bx lr
|
bx lr
|
||||||
END(__futex_wake)
|
END(__futex_wake)
|
||||||
|
|
Loading…
Reference in a new issue