diff --git a/libc/arch-arm/bionic/_exit_with_stack_teardown.S b/libc/arch-arm/bionic/_exit_with_stack_teardown.S index c2d7758fc..b00ea28d2 100644 --- a/libc/arch-arm/bionic/_exit_with_stack_teardown.S +++ b/libc/arch-arm/bionic/_exit_with_stack_teardown.S @@ -25,27 +25,20 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#include + #include +#include -@ 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) diff --git a/libc/arch-arm/bionic/clone.S b/libc/arch-arm/bionic/clone.S index 7ff3d0d2b..c91186c75 100644 --- a/libc/arch-arm/bionic/clone.S +++ b/libc/arch-arm/bionic/clone.S @@ -25,8 +25,9 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#include + #include +#include 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 diff --git a/libc/arch-arm/bionic/futex_arm.S b/libc/arch-arm/bionic/futex_arm.S index 704166396..bbd0629b8 100644 --- a/libc/arch-arm/bionic/futex_arm.S +++ b/libc/arch-arm/bionic/futex_arm.S @@ -25,32 +25,14 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + #include #include -#include #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) diff --git a/libc/arch-arm/bionic/syscall.S b/libc/arch-arm/bionic/syscall.S index ada12a652..69f3beca5 100644 --- a/libc/arch-arm/bionic/syscall.S +++ b/libc/arch-arm/bionic/syscall.S @@ -25,47 +25,21 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + +#include #include - - .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)