diff options
Diffstat (limited to 'libc/arch-arm64/bionic')
-rw-r--r-- | libc/arch-arm64/bionic/__bionic_clone.S | 29 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/__get_sp.S | 34 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/__rt_sigreturn.S | 3 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/__set_tls.c | 4 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/_exit_with_stack_teardown.S | 2 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/_setjmp.S | 14 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/bzero_arm64.c | 33 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/cacheflush_arm64.c | 33 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/futex_arm64.S | 86 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/setjmp.S | 16 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/sigsetjmp.S | 10 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/syscall.S | 13 | ||||
-rw-r--r-- | libc/arch-arm64/bionic/vfork.S | 4 |
13 files changed, 40 insertions, 241 deletions
diff --git a/libc/arch-arm64/bionic/__bionic_clone.S b/libc/arch-arm64/bionic/__bionic_clone.S index 9790291..56ac0f6 100644 --- a/libc/arch-arm64/bionic/__bionic_clone.S +++ b/libc/arch-arm64/bionic/__bionic_clone.S @@ -31,33 +31,30 @@ // pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg); ENTRY(__bionic_clone) - stp x29, x30, [sp, #-16]! - mov x29, sp - str x8, [sp, #-16]! - - /* store thread pointer & args in child stack */ + # Copy 'fn' and 'arg' onto the child stack. stp x5, x6, [x1, #-16] - /* sys_clone */ - uxtw x0, w0 + # Make the system call. mov x8, __NR_clone svc #0 - /* check for child/parent */ - cbz x0,1f - - ldr x8, [sp], #16 - ldp x29, x30, [sp], #16 + # Are we the child? + cbz x0, .L_bc_child + # Set errno if something went wrong. cmn x0, #(MAX_ERRNO + 1) cneg x0, x0, hi - b.hi __set_errno + b.hi __set_errno_internal ret - /* thread initialization - set the end of the frame record chain */ -1: +.L_bc_child: + # We're in the child now. Set the end of the frame record chain... mov x29, xzr + # Setting x30 to 0 will make the unwinder stop at __start_thread + mov x30, xzr + # ...and call __start_thread with the 'fn' and 'arg' we stored on the child stack. ldp x0, x1, [sp, #-16] - b __bionic_clone_entry + b __start_thread END(__bionic_clone) +.hidden __bionic_clone diff --git a/libc/arch-arm64/bionic/__get_sp.S b/libc/arch-arm64/bionic/__get_sp.S deleted file mode 100644 index 3cd4ceb..0000000 --- a/libc/arch-arm64/bionic/__get_sp.S +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> - -ENTRY(__get_sp) - mov x0, sp - ret -END(__get_sp) diff --git a/libc/arch-arm64/bionic/__rt_sigreturn.S b/libc/arch-arm64/bionic/__rt_sigreturn.S index d176ea3..8fb6f0c 100644 --- a/libc/arch-arm64/bionic/__rt_sigreturn.S +++ b/libc/arch-arm64/bionic/__rt_sigreturn.S @@ -26,8 +26,7 @@ * SUCH DAMAGE. */ -#include <asm/unistd.h> -#include <machine/asm.h> +#include <private/bionic_asm.h> ENTRY_PRIVATE(__rt_sigreturn) mov x8, __NR_rt_sigreturn diff --git a/libc/arch-arm64/bionic/__set_tls.c b/libc/arch-arm64/bionic/__set_tls.c index 4eb3ade..0d88d11 100644 --- a/libc/arch-arm64/bionic/__set_tls.c +++ b/libc/arch-arm64/bionic/__set_tls.c @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ -void __set_tls(void* tls) { +#include <sys/cdefs.h> + +__LIBC_HIDDEN__ void __set_tls(void* tls) { asm("msr tpidr_el0, %0" : : "r" (tls)); } diff --git a/libc/arch-arm64/bionic/_exit_with_stack_teardown.S b/libc/arch-arm64/bionic/_exit_with_stack_teardown.S index 075e388..6a7b1e5 100644 --- a/libc/arch-arm64/bionic/_exit_with_stack_teardown.S +++ b/libc/arch-arm64/bionic/_exit_with_stack_teardown.S @@ -29,7 +29,7 @@ #include <private/bionic_asm.h> // void _exit_with_stack_teardown(void* stackBase, size_t stackSize) -ENTRY(_exit_with_stack_teardown) +ENTRY_PRIVATE(_exit_with_stack_teardown) mov w8, __NR_munmap svc #0 // If munmap failed, we ignore the failure and exit anyway. diff --git a/libc/arch-arm64/bionic/_setjmp.S b/libc/arch-arm64/bionic/_setjmp.S index ea70a52..3836899 100644 --- a/libc/arch-arm64/bionic/_setjmp.S +++ b/libc/arch-arm64/bionic/_setjmp.S @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include <private/bionic_asm.h> #include <machine/setjmp.h> /* @@ -73,7 +73,7 @@ ENTRY(_longjmp) ldr w9, .L_setjmp_magic ldr w10, [x0, #(_JB_MAGIC * 4)] cmp w9, w10 - b.ne botch + b.ne .L_fail /* restore core registers */ ldp x30, x10, [x0, #(_JB_CORE_BASE * 4 + 16 * 0)] @@ -93,10 +93,10 @@ ENTRY(_longjmp) /* validate sp (sp mod 16 = 0) and lr (lr mod 4 = 0) */ tst x30, #3 - b.ne botch + b.ne .L_fail mov x10, sp tst x10, #15 - b.ne botch + b.ne .L_fail /* set return value */ cmp w1, wzr @@ -104,8 +104,8 @@ ENTRY(_longjmp) ret /* validation failed, die die die */ -botch: - bl PIC_SYM(_C_LABEL(longjmperror), PLT) - bl PIC_SYM(_C_LABEL(abort), PLT) +.L_fail: + bl PIC_SYM(longjmperror, PLT) + bl PIC_SYM(abort, PLT) b . - 8 /* Cannot get here */ END(_longjmp) diff --git a/libc/arch-arm64/bionic/bzero_arm64.c b/libc/arch-arm64/bionic/bzero_arm64.c deleted file mode 100644 index 1ef920c..0000000 --- a/libc/arch-arm64/bionic/bzero_arm64.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <string.h> - -void bzero(void* s, size_t n) { - memset(s, '\0', n); -} diff --git a/libc/arch-arm64/bionic/cacheflush_arm64.c b/libc/arch-arm64/bionic/cacheflush_arm64.c deleted file mode 100644 index 1354fee..0000000 --- a/libc/arch-arm64/bionic/cacheflush_arm64.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* TODO: We can implement a specialised cacheflush() */ -int cacheflush (long start, long end, long flags __attribute__((unused))) { - __builtin___clear_cache((char*) start, (char*) end); - return 0; -} diff --git a/libc/arch-arm64/bionic/futex_arm64.S b/libc/arch-arm64/bionic/futex_arm64.S deleted file mode 100644 index d452771..0000000 --- a/libc/arch-arm64/bionic/futex_arm64.S +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <private/bionic_asm.h> - -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 - -// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout) -ENTRY(__futex_syscall4) - stp x29, x30, [sp, #-16]! - mov x29, sp - - str x8, [sp, #-16]! - mov x8, __NR_futex - svc #0 - ldr x8, [sp], #16 - - ldp x29, x30, [sp], #16 - ret -END(__futex_syscall4) - -// int __futex_syscall3(volatile void* ftx, int op, int count) -ENTRY(__futex_syscall3) - b __futex_syscall4 -END(__futex_syscall3) - -// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout) -ENTRY(__futex_wait) - stp x29, x30, [sp, #-16]! - mov x29, sp - - mov x3, x2 - mov x2, x1 - mov x1, #FUTEX_WAIT - - str x8, [sp, #-16]! - mov x8, __NR_futex - svc #0 - ldr x8, [sp], #16 - - ldp x29, x30, [sp], #16 - ret -END(__futex_wait) - -// int __futex_wake(volatile void* ftx, int count) -ENTRY(__futex_wake) - stp x29, x30, [sp, #-16]! - mov x29, sp - - mov x2, x1 - mov x1, #FUTEX_WAKE - - str x8, [sp, #-16]! - mov x8, __NR_futex - svc #0 - ldr x8, [sp], #16 - - ldp x29, x30, [sp], #16 - ret -END(__futex_wake) diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S index b1ec0a8..f9d2266 100644 --- a/libc/arch-arm64/bionic/setjmp.S +++ b/libc/arch-arm64/bionic/setjmp.S @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include <private/bionic_asm.h> #include <machine/setjmp.h> /* @@ -45,7 +45,7 @@ ENTRY(setjmp) stp x0, x30, [sp, #-16]! mov x0, xzr - bl PIC_SYM(_C_LABEL(sigblock), PLT) + bl PIC_SYM(sigblock, PLT) mov w1, w0 ldp x0, x30, [sp], #16 @@ -85,7 +85,7 @@ ENTRY(longjmp) ldr w9, .L_setjmp_magic ldr w10, [x0, #(_JB_MAGIC * 4)] cmp w9, w10 - b.ne botch + b.ne .L_fail /* restore core registers */ ldp x30, x10, [x0, #(_JB_CORE_BASE * 4 + 16 * 0)] @@ -105,10 +105,10 @@ ENTRY(longjmp) /* validate sp (sp mod 16 = 0) and lr (lr mod 4 = 0) */ tst x30, #3 - b.ne botch + b.ne .L_fail mov x10, sp tst x10, #15 - b.ne botch + b.ne .L_fail /* set return value */ cmp w1, wzr @@ -116,8 +116,8 @@ ENTRY(longjmp) ret /* validation failed, die die die */ -botch: - bl PIC_SYM(_C_LABEL(longjmperror), PLT) - bl PIC_SYM(_C_LABEL(abort), PLT) +.L_fail: + bl PIC_SYM(longjmperror, PLT) + bl PIC_SYM(abort, PLT) b . - 8 /* Cannot get here */ END(longjmp) diff --git a/libc/arch-arm64/bionic/sigsetjmp.S b/libc/arch-arm64/bionic/sigsetjmp.S index 3afceab..4fdb367 100644 --- a/libc/arch-arm64/bionic/sigsetjmp.S +++ b/libc/arch-arm64/bionic/sigsetjmp.S @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include <private/bionic_asm.h> #include <machine/setjmp.h> /* @@ -35,8 +35,8 @@ */ ENTRY(sigsetjmp) - cbz w1, PIC_SYM(_C_LABEL(_setjmp), PLT) - b PIC_SYM(_C_LABEL(setjmp), PLT) + cbz w1, PIC_SYM(_setjmp, PLT) + b PIC_SYM(setjmp, PLT) END(sigsetjmp) .L_setjmp_magic: @@ -46,6 +46,6 @@ ENTRY(siglongjmp) ldr w2, .L_setjmp_magic ldr w3, [x0] cmp w2, w3 - b.eq PIC_SYM(_C_LABEL(_longjmp), PLT) - b PIC_SYM(_C_LABEL(longjmp), PLT) + b.eq PIC_SYM(_longjmp, PLT) + b PIC_SYM(longjmp, PLT) END(siglongjmp) diff --git a/libc/arch-arm64/bionic/syscall.S b/libc/arch-arm64/bionic/syscall.S index e5be1d5..8389f98 100644 --- a/libc/arch-arm64/bionic/syscall.S +++ b/libc/arch-arm64/bionic/syscall.S @@ -29,13 +29,6 @@ #include <private/bionic_asm.h> ENTRY(syscall) - /* create AAPCS frame pointer */ - stp x29, x30, [sp, #-16]! - mov x29, sp - - /* store x8 */ - str x8, [sp, #-16]! - /* Move syscall No. from x0 to x8 */ mov x8, x0 /* Move syscall parameters from x1 thru x6 to x0 thru x5 */ @@ -47,14 +40,10 @@ ENTRY(syscall) mov x5, x6 svc #0 - /* restore x8 */ - ldr x8, [sp], #16 - ldp x29, x30, [sp], #16 - /* check if syscall returned successfully */ cmn x0, #(MAX_ERRNO + 1) cneg x0, x0, hi - b.hi __set_errno + b.hi __set_errno_internal ret END(syscall) diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S index 52009e2..b6a672d 100644 --- a/libc/arch-arm64/bionic/vfork.S +++ b/libc/arch-arm64/bionic/vfork.S @@ -37,14 +37,12 @@ ENTRY(vfork) mov x3, xzr mov x4, xzr - str x8, [sp, #-16]! mov x8, __NR_clone svc #0 - ldr x8, [sp], #16 cmn x0, #(MAX_ERRNO + 1) cneg x0, x0, hi - b.hi __set_errno + b.hi __set_errno_internal ret END(vfork) |