Merge "Clean up ARM assembler files to use ENTRY/END."
This commit is contained in:
commit
1fea0f258a
@ -25,27 +25,20 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <asm/unistd.h>
|
|
||||||
#include <machine/asm.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)
|
ENTRY(_exit_with_stack_teardown)
|
||||||
|
|
||||||
#if __ARM_EABI__
|
|
||||||
mov lr, r2
|
mov lr, r2
|
||||||
ldr r7, =__NR_munmap
|
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
|
mov r0, lr
|
||||||
ldr r7, =__NR_exit
|
ldr r7, =__NR_exit
|
||||||
swi #0
|
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
|
// exit() should never return, cause a crash if it does
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
ldr r0, [r0]
|
ldr r0, [r0]
|
||||||
END(_exit_with_stack_teardown)
|
END(_exit_with_stack_teardown)
|
||||||
|
@ -25,8 +25,9 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <sys/linux-syscalls.h>
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
ENTRY(__pthread_clone)
|
ENTRY(__pthread_clone)
|
||||||
@ insert the args onto the new stack
|
@ insert the args onto the new stack
|
||||||
@ -39,18 +40,12 @@ ENTRY(__pthread_clone)
|
|||||||
|
|
||||||
@ new sp is already in r1
|
@ new sp is already in r1
|
||||||
|
|
||||||
#if __ARM_EABI__
|
|
||||||
stmfd sp!, {r4, r7}
|
stmfd sp!, {r4, r7}
|
||||||
ldr r7, =__NR_clone
|
ldr r7, =__NR_clone
|
||||||
swi #0
|
swi #0
|
||||||
#else
|
|
||||||
swi #__NR_clone
|
|
||||||
#endif
|
|
||||||
|
|
||||||
movs r0, r0
|
movs r0, r0
|
||||||
#if __ARM_EABI__
|
|
||||||
ldmnefd sp!, {r4, r7}
|
ldmnefd sp!, {r4, r7}
|
||||||
#endif
|
|
||||||
blt __error
|
blt __error
|
||||||
bxne lr
|
bxne lr
|
||||||
|
|
||||||
|
@ -25,32 +25,14 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/linux-syscalls.h>
|
#include <sys/linux-syscalls.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include <machine/cpu-features.h>
|
|
||||||
|
|
||||||
#define FUTEX_WAIT 0
|
#define FUTEX_WAIT 0
|
||||||
#define FUTEX_WAKE 1
|
#define FUTEX_WAKE 1
|
||||||
|
|
||||||
/* __futex_wait(*ftx, val, *timespec) */
|
// __futex_syscall3(*ftx, op, val)
|
||||||
/* __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__
|
|
||||||
|
|
||||||
ENTRY(__futex_syscall3)
|
ENTRY(__futex_syscall3)
|
||||||
stmdb sp!, {r4, r7}
|
stmdb sp!, {r4, r7}
|
||||||
.save {r4, r7}
|
.save {r4, r7}
|
||||||
@ -60,53 +42,32 @@ ENTRY(__futex_syscall3)
|
|||||||
bx lr
|
bx lr
|
||||||
END(__futex_syscall3)
|
END(__futex_syscall3)
|
||||||
|
|
||||||
ENTRY(__futex_wait)
|
// __futex_syscall4(*ftx, op, val, *timespec)
|
||||||
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
|
|
||||||
|
|
||||||
ENTRY(__futex_syscall4)
|
ENTRY(__futex_syscall4)
|
||||||
b __futex_syscall3
|
b __futex_syscall3
|
||||||
END(__futex_syscall4)
|
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
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <machine/asm.h>
|
||||||
#include <sys/linux-syscalls.h>
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
|
ENTRY(syscall)
|
||||||
.text
|
|
||||||
.align 4
|
|
||||||
.type syscall,#function
|
|
||||||
.globl syscall
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align
|
|
||||||
|
|
||||||
#if __ARM_EABI__
|
|
||||||
|
|
||||||
syscall:
|
|
||||||
mov ip, sp
|
mov ip, sp
|
||||||
stmfd sp!, {r4, r5, r6, r7}
|
stmfd sp!, {r4, r5, r6, r7}
|
||||||
mov r7, r0
|
mov r7, r0
|
||||||
mov r0, r1
|
mov r0, r1
|
||||||
mov r1, r2
|
mov r1, r2
|
||||||
mov r2, r3
|
mov r2, r3
|
||||||
ldmfd ip, {r3, r4, r5, r6}
|
ldmfd ip, {r3, r4, r5, r6}
|
||||||
swi #0
|
swi #0
|
||||||
ldmfd sp!, {r4, r5, r6, r7}
|
ldmfd sp!, {r4, r5, r6, r7}
|
||||||
movs r0, r0
|
movs r0, r0
|
||||||
bxpl lr
|
bxpl lr
|
||||||
b __set_syscall_errno
|
b __set_syscall_errno
|
||||||
|
END(syscall)
|
||||||
#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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user