am 1fea0f25
: Merge "Clean up ARM assembler files to use ENTRY/END."
# Via Elliott Hughes (1) and Gerrit Code Review (1) * commit '1fea0f258a45d918fe5ae8e9769f45c0348bd095': Clean up ARM assembler files to use ENTRY/END.
This commit is contained in:
commit
03798dd23c
4 changed files with 43 additions and 120 deletions
|
@ -25,27 +25,20 @@
|
|||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <sys/linux-syscalls.h>
|
||||
|
||||
@ void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode)
|
||||
// void _exit_with_stack_teardown(void* stackBase, int stackSize, int retCode)
|
||||
ENTRY(_exit_with_stack_teardown)
|
||||
|
||||
#if __ARM_EABI__
|
||||
mov lr, r2
|
||||
ldr r7, =__NR_munmap
|
||||
swi #0 @ the stack is destroyed by this call
|
||||
swi #0 // the stack is destroyed by this call
|
||||
mov r0, lr
|
||||
ldr r7, =__NR_exit
|
||||
swi #0
|
||||
#else
|
||||
mov lr, r2
|
||||
swi # __NR_munmap @ the stack is destroyed by this call
|
||||
mov r0, lr
|
||||
swi # __NR_exit
|
||||
#endif
|
||||
|
||||
@ exit() should never return, cause a crash if it does
|
||||
mov r0, #0
|
||||
ldr r0, [r0]
|
||||
// exit() should never return, cause a crash if it does
|
||||
mov r0, #0
|
||||
ldr r0, [r0]
|
||||
END(_exit_with_stack_teardown)
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/linux-syscalls.h>
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <sys/linux-syscalls.h>
|
||||
|
||||
ENTRY(__pthread_clone)
|
||||
@ insert the args onto the new stack
|
||||
|
@ -39,18 +40,12 @@ ENTRY(__pthread_clone)
|
|||
|
||||
@ new sp is already in r1
|
||||
|
||||
#if __ARM_EABI__
|
||||
stmfd sp!, {r4, r7}
|
||||
ldr r7, =__NR_clone
|
||||
swi #0
|
||||
#else
|
||||
swi #__NR_clone
|
||||
#endif
|
||||
|
||||
movs r0, r0
|
||||
#if __ARM_EABI__
|
||||
ldmnefd sp!, {r4, r7}
|
||||
#endif
|
||||
blt __error
|
||||
bxne lr
|
||||
|
||||
|
|
|
@ -25,32 +25,14 @@
|
|||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/linux-syscalls.h>
|
||||
#include <machine/asm.h>
|
||||
#include <machine/cpu-features.h>
|
||||
|
||||
#define FUTEX_WAIT 0
|
||||
#define FUTEX_WAKE 1
|
||||
|
||||
/* __futex_wait(*ftx, val, *timespec) */
|
||||
/* __futex_wake(*ftx, counter) */
|
||||
/* __futex_syscall3(*ftx, op, val) */
|
||||
/* __futex_syscall4(*ftx, op, val, *timespec) */
|
||||
|
||||
.global __futex_wait
|
||||
.type __futex_wait, %function
|
||||
|
||||
.global __futex_wake
|
||||
.type __futex_wake, %function
|
||||
|
||||
.global __futex_syscall3
|
||||
.type __futex_syscall3, %function
|
||||
|
||||
.global __futex_syscall4
|
||||
.type __futex_syscall4, %function
|
||||
|
||||
#if __ARM_EABI__
|
||||
|
||||
// __futex_syscall3(*ftx, op, val)
|
||||
ENTRY(__futex_syscall3)
|
||||
stmdb sp!, {r4, r7}
|
||||
.save {r4, r7}
|
||||
|
@ -60,53 +42,32 @@ ENTRY(__futex_syscall3)
|
|||
bx lr
|
||||
END(__futex_syscall3)
|
||||
|
||||
ENTRY(__futex_wait)
|
||||
stmdb sp!, {r4, r7}
|
||||
.save {r4, r7}
|
||||
mov r3, r2
|
||||
mov r2, r1
|
||||
mov r1, #FUTEX_WAIT
|
||||
ldr r7, =__NR_futex
|
||||
swi #0
|
||||
ldmia sp!, {r4, r7}
|
||||
bx lr
|
||||
END(__futex_wait)
|
||||
|
||||
ENTRY(__futex_wake)
|
||||
.save {r4, r7}
|
||||
stmdb sp!, {r4, r7}
|
||||
mov r2, r1
|
||||
mov r1, #FUTEX_WAKE
|
||||
ldr r7, =__NR_futex
|
||||
swi #0
|
||||
ldmia sp!, {r4, r7}
|
||||
bx lr
|
||||
END(__futex_wake)
|
||||
|
||||
#else
|
||||
|
||||
ENTRY(__futex_syscall3)
|
||||
swi #__NR_futex
|
||||
bx lr
|
||||
END(__futex_syscall3)
|
||||
|
||||
ENTRY(__futex_wait)
|
||||
mov r3, r2
|
||||
mov r2, r1
|
||||
mov r1, #FUTEX_WAIT
|
||||
swi #__NR_futex
|
||||
bx lr
|
||||
END(__futex_wait)
|
||||
|
||||
ENTRY(__futex_wake)
|
||||
mov r2, r1
|
||||
mov r1, #FUTEX_WAKE
|
||||
swi #__NR_futex
|
||||
bx lr
|
||||
END(__futex_wake)
|
||||
|
||||
#endif
|
||||
|
||||
// __futex_syscall4(*ftx, op, val, *timespec)
|
||||
ENTRY(__futex_syscall4)
|
||||
b __futex_syscall3
|
||||
END(__futex_syscall4)
|
||||
|
||||
// __futex_wait(*ftx, val, *timespec)
|
||||
ENTRY(__futex_wait)
|
||||
stmdb sp!, {r4, r7}
|
||||
.save {r4, r7}
|
||||
mov r3, r2
|
||||
mov r2, r1
|
||||
mov r1, #FUTEX_WAIT
|
||||
ldr r7, =__NR_futex
|
||||
swi #0
|
||||
ldmia sp!, {r4, r7}
|
||||
bx lr
|
||||
END(__futex_wait)
|
||||
|
||||
// __futex_wake(*ftx, counter)
|
||||
ENTRY(__futex_wake)
|
||||
.save {r4, r7}
|
||||
stmdb sp!, {r4, r7}
|
||||
mov r2, r1
|
||||
mov r1, #FUTEX_WAKE
|
||||
ldr r7, =__NR_futex
|
||||
swi #0
|
||||
ldmia sp!, {r4, r7}
|
||||
bx lr
|
||||
END(__futex_wake)
|
||||
|
|
|
@ -25,47 +25,21 @@
|
|||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <sys/linux-syscalls.h>
|
||||
|
||||
|
||||
.text
|
||||
.align 4
|
||||
.type syscall,#function
|
||||
.globl syscall
|
||||
|
||||
.text
|
||||
.align
|
||||
|
||||
#if __ARM_EABI__
|
||||
|
||||
syscall:
|
||||
ENTRY(syscall)
|
||||
mov ip, sp
|
||||
stmfd sp!, {r4, r5, r6, r7}
|
||||
stmfd sp!, {r4, r5, r6, r7}
|
||||
mov r7, r0
|
||||
mov r0, r1
|
||||
mov r1, r2
|
||||
mov r2, r3
|
||||
ldmfd ip, {r3, r4, r5, r6}
|
||||
ldmfd ip, {r3, r4, r5, r6}
|
||||
swi #0
|
||||
ldmfd sp!, {r4, r5, r6, r7}
|
||||
movs r0, r0
|
||||
bxpl lr
|
||||
b __set_syscall_errno
|
||||
|
||||
#else
|
||||
|
||||
#ifndef __NR_syscall
|
||||
#define __NR_syscall 113
|
||||
#endif
|
||||
|
||||
syscall:
|
||||
stmfd sp!, {r4, r5, lr}
|
||||
ldr r4, [sp, #12]
|
||||
ldr r5, [sp, #16]
|
||||
swi __NR_syscall
|
||||
ldmfd sp!, {r4, r5, lr}
|
||||
movs r0, r0
|
||||
bxpl lr
|
||||
b __set_syscall_errno
|
||||
|
||||
#endif
|
||||
END(syscall)
|
||||
|
|
Loading…
Reference in a new issue