From fd9a2ad443fd648189f56e7032223df89aafb682 Mon Sep 17 00:00:00 2001 From: skrll Date: Wed, 21 Apr 2021 16:23:47 +0000 Subject: [PATCH] Do previous differently as the API is different. --- .../lib/libc/arch/aarch64/atomic/Makefile.inc | 10 ++--- ...mic_swap_rel_32.S => __aarch64_swp1_acq.S} | 13 +++--- ..._swap_rel_8.S => __aarch64_swp1_acq_rel.S} | 13 +++--- ...mic_swap_acq_32.S => __aarch64_swp1_rel.S} | 13 +++--- ...ic_swap_acq_8.S => __aarch64_swp1_relax.S} | 13 +++--- ...mic_swap_acq_64.S => __aarch64_swp2_acq.S} | 13 +++--- .../aarch64/atomic/__aarch64_swp2_acq_rel.S | 41 +++++++++++++++++ ...mic_swap_rel_64.S => __aarch64_swp2_rel.S} | 13 +++--- .../aarch64/atomic/__aarch64_swp2_relax.S | 41 +++++++++++++++++ .../arch/aarch64/atomic/__aarch64_swp4_acq.S | 41 +++++++++++++++++ .../aarch64/atomic/__aarch64_swp4_acq_rel.S | 41 +++++++++++++++++ .../arch/aarch64/atomic/__aarch64_swp4_rel.S | 41 +++++++++++++++++ .../aarch64/atomic/__aarch64_swp4_relax.S | 41 +++++++++++++++++ .../arch/aarch64/atomic/__aarch64_swp8_acq.S | 41 +++++++++++++++++ .../aarch64/atomic/__aarch64_swp8_acq_rel.S | 41 +++++++++++++++++ .../arch/aarch64/atomic/__aarch64_swp8_rel.S | 41 +++++++++++++++++ .../aarch64/atomic/__aarch64_swp8_relax.S | 41 +++++++++++++++++ .../libc/arch/aarch64/atomic/atomic_swap_16.S | 3 +- .../libc/arch/aarch64/atomic/atomic_swap_32.S | 3 +- .../libc/arch/aarch64/atomic/atomic_swap_64.S | 3 +- .../libc/arch/aarch64/atomic/atomic_swap_8.S | 3 +- .../arch/aarch64/atomic/atomic_swap_acq_16.S | 44 ------------------- .../aarch64/atomic/atomic_swap_acq_rel_16.S | 44 ------------------- .../aarch64/atomic/atomic_swap_acq_rel_32.S | 44 ------------------- .../aarch64/atomic/atomic_swap_acq_rel_64.S | 44 ------------------- .../aarch64/atomic/atomic_swap_acq_rel_8.S | 44 ------------------- .../arch/aarch64/atomic/atomic_swap_rel_16.S | 44 ------------------- 27 files changed, 449 insertions(+), 325 deletions(-) rename common/lib/libc/arch/aarch64/atomic/{atomic_swap_rel_32.S => __aarch64_swp1_acq.S} (85%) rename common/lib/libc/arch/aarch64/atomic/{atomic_swap_rel_8.S => __aarch64_swp1_acq_rel.S} (84%) rename common/lib/libc/arch/aarch64/atomic/{atomic_swap_acq_32.S => __aarch64_swp1_rel.S} (85%) rename common/lib/libc/arch/aarch64/atomic/{atomic_swap_acq_8.S => __aarch64_swp1_relax.S} (84%) rename common/lib/libc/arch/aarch64/atomic/{atomic_swap_acq_64.S => __aarch64_swp2_acq.S} (85%) create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq_rel.S rename common/lib/libc/arch/aarch64/atomic/{atomic_swap_rel_64.S => __aarch64_swp2_rel.S} (85%) create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_relax.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq_rel.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_rel.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_relax.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq_rel.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_rel.S create mode 100644 common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_relax.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_16.S diff --git a/common/lib/libc/arch/aarch64/atomic/Makefile.inc b/common/lib/libc/arch/aarch64/atomic/Makefile.inc index df9af28544c1..e65076b05829 100644 --- a/common/lib/libc/arch/aarch64/atomic/Makefile.inc +++ b/common/lib/libc/arch/aarch64/atomic/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.2 2021/04/21 07:31:37 skrll Exp $ +# $NetBSD: Makefile.inc,v 1.3 2021/04/21 16:23:47 skrll Exp $ .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ || ${LIB} == "rump") @@ -12,10 +12,10 @@ SRCS.atomic+= atomic_dec_32.S atomic_dec_64.S SRCS.atomic+= atomic_inc_32.S atomic_inc_64.S SRCS.atomic+= membar_ops.S #and cas nand or sub swap xor -.for op in swap -.for sz in 8 16 32 64 -.for ar in acq rel acq_rel -SRCS.atomic+= atomic_${op}_${ar}_${sz}.S +.for op in swp +.for sz in 1 2 4 8 +.for ar in relax acq rel acq_rel +SRCS.atomic+= __aarch64_${op}${sz}_${ar}.S .endfor .endfor .endfor diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_32.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_acq.S similarity index 85% rename from common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_32.S rename to common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_acq.S index bf94d9794822..cfc74cdd6036 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_32.S +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_acq.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_rel_32.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: __aarch64_swp1_acq.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -31,14 +31,11 @@ #include "atomic_op_asm.h" -ENTRY_NP(_atomic_swap_rel_32) +ENTRY_NP(__aarch64_swp1_acq) mov x4, x0 -1: ldxr w0, [x4] - stlxr w3, w1, [x4] +1: ldaxrb w0, [x1] + stxrb w3, w4, [x1] cbnz w3, 2f ret 2: b 1b -END(_atomic_swap_rel_32) - -ATOMIC_OP_ALIAS(atomic_swap_rel_32,_atomic_swap_rel_32) -ATOMIC_OP_ALIAS(__aarch64_swp4_rel,_atomic_swap_rel_32) +END(__aarch64_swp1_acq) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_8.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_acq_rel.S similarity index 84% rename from common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_8.S rename to common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_acq_rel.S index 5ba0d7212119..a317717261de 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_8.S +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_acq_rel.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_rel_8.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: __aarch64_swp1_acq_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -31,14 +31,11 @@ #include "atomic_op_asm.h" -ENTRY_NP(_atomic_swap_rel_8) +ENTRY_NP(__aarch64_swp1_acq_rel) mov x4, x0 -1: ldxrb w0, [x4] - stlxrb w3, w1, [x4] +1: ldaxrb w0, [x1] + stlxrb w3, w4, [x1] cbnz w3, 2f ret 2: b 1b -END(_atomic_swap_rel_8) - -ATOMIC_OP_ALIAS(atomic_swap_rel_8,_atomic_swap_rel_8) -ATOMIC_OP_ALIAS(__aarch64_swp1_rel,_atomic_swap_rel_8) +END(__aarch64_swp1_acq_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_32.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_rel.S similarity index 85% rename from common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_32.S rename to common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_rel.S index c7183bc4cf1b..3658813c4949 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_32.S +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_rel.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_acq_32.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: __aarch64_swp1_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -31,14 +31,11 @@ #include "atomic_op_asm.h" -ENTRY_NP(_atomic_swap_acq_32) +ENTRY_NP(__aarch64_swp1_rel) mov x4, x0 -1: ldaxr w0, [x4] - stxr w3, w1, [x4] +1: ldxrb w0, [x1] + stlxrb w3, w4, [x1] cbnz w3, 2f ret 2: b 1b -END(_atomic_swap_acq_32) - -ATOMIC_OP_ALIAS(atomic_swap_acq_32,_atomic_swap_acq_32) -ATOMIC_OP_ALIAS(__aarch64_swp4_acq,_atomic_swap_acq_32) +END(__aarch64_swp1_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_8.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_relax.S similarity index 84% rename from common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_8.S rename to common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_relax.S index a0045aec75bb..0d0511197f3b 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_8.S +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp1_relax.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_acq_8.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: __aarch64_swp1_relax.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -31,14 +31,11 @@ #include "atomic_op_asm.h" -ENTRY_NP(_atomic_swap_acq_8) +ENTRY_NP(__aarch64_swp1_relax) mov x4, x0 -1: ldaxrb w0, [x4] - stxrb w3, w1, [x4] +1: ldxrb w0, [x1] + stxrb w3, w4, [x1] cbnz w3, 2f ret 2: b 1b -END(_atomic_swap_acq_8) - -ATOMIC_OP_ALIAS(atomic_swap_acq_8,_atomic_swap_acq_8) -ATOMIC_OP_ALIAS(__aarch64_swp1_acq,_atomic_swap_acq_8) +END(__aarch64_swp1_relax) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_64.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq.S similarity index 85% rename from common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_64.S rename to common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq.S index 062eee8e7c4a..fc4932a28402 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_64.S +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_acq_64.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: __aarch64_swp2_acq.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -31,14 +31,11 @@ #include "atomic_op_asm.h" -ENTRY_NP(_atomic_swap_acq_64) +ENTRY_NP(__aarch64_swp2_acq) mov x4, x0 -1: ldaxr x0, [x4] - stxr w3, x1, [x4] +1: ldaxrh w0, [x1] + stxrh w3, w4, [x1] cbnz w3, 2f ret 2: b 1b -END(_atomic_swap_acq_64) - -ATOMIC_OP_ALIAS(atomic_swap_acq_64,_atomic_swap_acq_64) -ATOMIC_OP_ALIAS(__aarch64_swp8_acq,_atomic_swap_acq_64) +END(__aarch64_swp2_acq) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq_rel.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq_rel.S new file mode 100644 index 000000000000..5eedb378918d --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_acq_rel.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp2_acq_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp2_acq_rel) + mov x4, x0 +1: ldaxrh w0, [x1] + stlxrh w3, w4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp2_acq_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_64.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_rel.S similarity index 85% rename from common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_64.S rename to common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_rel.S index 8772efde16db..949caa7ebc80 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_64.S +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_rel.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_rel_64.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: __aarch64_swp2_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -31,14 +31,11 @@ #include "atomic_op_asm.h" -ENTRY_NP(_atomic_swap_rel_64) +ENTRY_NP(__aarch64_swp2_rel) mov x4, x0 -1: ldxr x0, [x4] - stlxr w3, x1, [x4] +1: ldxrh w0, [x1] + stlxrh w3, w4, [x1] cbnz w3, 2f ret 2: b 1b -END(_atomic_swap_rel_64) - -ATOMIC_OP_ALIAS(atomic_swap_rel_64,_atomic_swap_rel_64) -ATOMIC_OP_ALIAS(__aarch64_swp8_rel,_atomic_swap_rel_64) +END(__aarch64_swp2_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_relax.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_relax.S new file mode 100644 index 000000000000..50adbe526a8e --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp2_relax.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp2_relax.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp2_relax) + mov x4, x0 +1: ldxrh w0, [x1] + stxrh w3, w4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp2_relax) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq.S new file mode 100644 index 000000000000..253b57ca3775 --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp4_acq.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp4_acq) + mov x4, x0 +1: ldaxr w0, [x1] + stxr w3, w4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp4_acq) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq_rel.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq_rel.S new file mode 100644 index 000000000000..4751b0b18e12 --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_acq_rel.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp4_acq_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp4_acq_rel) + mov x4, x0 +1: ldaxr w0, [x1] + stlxr w3, w4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp4_acq_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_rel.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_rel.S new file mode 100644 index 000000000000..d6f6485a739d --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_rel.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp4_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp4_rel) + mov x4, x0 +1: ldxr w0, [x1] + stlxr w3, w4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp4_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_relax.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_relax.S new file mode 100644 index 000000000000..86b4235f7d9c --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp4_relax.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp4_relax.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp4_relax) + mov x4, x0 +1: ldxr w0, [x1] + stxr w3, w4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp4_relax) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq.S new file mode 100644 index 000000000000..776f9f790452 --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp8_acq.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp8_acq) + mov x4, x0 +1: ldaxr x0, [x1] + stxr w3, x4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp8_acq) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq_rel.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq_rel.S new file mode 100644 index 000000000000..2b3b0ad24ff3 --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_acq_rel.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp8_acq_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp8_acq_rel) + mov x4, x0 +1: ldaxr x0, [x1] + stlxr w3, x4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp8_acq_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_rel.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_rel.S new file mode 100644 index 000000000000..75d92d1e984c --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_rel.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp8_rel.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp8_rel) + mov x4, x0 +1: ldxr x0, [x1] + stlxr w3, x4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp8_rel) diff --git a/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_relax.S b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_relax.S new file mode 100644 index 000000000000..270974d6e08e --- /dev/null +++ b/common/lib/libc/arch/aarch64/atomic/__aarch64_swp8_relax.S @@ -0,0 +1,41 @@ +/* $NetBSD: __aarch64_swp8_relax.S,v 1.1 2021/04/21 16:23:47 skrll Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" + +ENTRY_NP(__aarch64_swp8_relax) + mov x4, x0 +1: ldxr x0, [x1] + stxr w3, x4, [x1] + cbnz w3, 2f + ret +2: b 1b +END(__aarch64_swp8_relax) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S index 4dfafc7db0cf..1f3cd95dfb42 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S +++ b/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_16.S,v 1.3 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: atomic_swap_16.S,v 1.4 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -43,7 +43,6 @@ END(_atomic_swap_16) ATOMIC_OP_ALIAS(atomic_swap_16,_atomic_swap_16) ATOMIC_OP_ALIAS(atomic_swap_short,_atomic_swap_16) ATOMIC_OP_ALIAS(atomic_swap_ushort,_atomic_swap_16) -ATOMIC_OP_ALIAS(__aarch64_swp2_relax,_atomic_swap_16) STRONG_ALIAS(__sync_lock_test_and_set_2,_atomic_swap_16) STRONG_ALIAS(_atomic_swap_short,_atomic_swap_16) STRONG_ALIAS(_atomic_swap_ushort,_atomic_swap_16) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S index 43b4a957771a..16863d6d0827 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S +++ b/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_32.S,v 1.3 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: atomic_swap_32.S,v 1.4 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -42,7 +42,6 @@ END(_atomic_swap_32) ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -ATOMIC_OP_ALIAS(__aarch64_swp4_relax,_atomic_swap_32) STRONG_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S index cd978f54cf41..e9ac40c2a888 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S +++ b/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_64.S,v 1.3 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: atomic_swap_64.S,v 1.4 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -43,7 +43,6 @@ END(_atomic_swap_64) ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64) ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64) -ATOMIC_OP_ALIAS(__aarch64_swp8_relax,_atomic_swap_64) STRONG_ALIAS(__sync_lock_test_and_set_8,_atomic_swap_64) STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S index c94b02ecbede..f2ba13e9fc5f 100644 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S +++ b/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_8.S,v 1.3 2021/04/21 07:31:37 skrll Exp $ */ +/* $NetBSD: atomic_swap_8.S,v 1.4 2021/04/21 16:23:47 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -43,7 +43,6 @@ END(_atomic_swap_8) ATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) ATOMIC_OP_ALIAS(atomic_swap_char,_atomic_swap_8) ATOMIC_OP_ALIAS(atomic_swap_uchar,_atomic_swap_8) -ATOMIC_OP_ALIAS(__aarch64_swp1_relax,_atomic_swap_8) STRONG_ALIAS(__sync_lock_test_and_set_1,_atomic_swap_8) STRONG_ALIAS(_atomic_swap_char,_atomic_swap_8) STRONG_ALIAS(_atomic_swap_uchar,_atomic_swap_8) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_16.S deleted file mode 100644 index 7100c7da2d57..000000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_16.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_swap_acq_16.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ - -/*- - * Copyright (c) 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_acq_16) - mov x4, x0 -1: ldaxrh w0, [x4] - stxrh w3, w1, [x4] - cbnz w3, 2f - ret -2: b 1b -END(_atomic_swap_acq_16) - -ATOMIC_OP_ALIAS(atomic_swap_acq_16,_atomic_swap_acq_16) -ATOMIC_OP_ALIAS(__aarch64_swp2_acq,_atomic_swap_acq_16) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_16.S deleted file mode 100644 index 8651fee9f534..000000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_16.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_swap_acq_rel_16.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ - -/*- - * Copyright (c) 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_acq_rel_16) - mov x4, x0 -1: ldaxrh w0, [x4] - stlxrh w3, w1, [x4] - cbnz w3, 2f - ret -2: b 1b -END(_atomic_swap_acq_rel_16) - -ATOMIC_OP_ALIAS(atomic_swap_acq_rel_16,_atomic_swap_acq_rel_16) -ATOMIC_OP_ALIAS(__aarch64_swp2_acq_rel,_atomic_swap_acq_rel_16) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_32.S deleted file mode 100644 index dced9f4f3599..000000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_32.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_swap_acq_rel_32.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ - -/*- - * Copyright (c) 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_acq_rel_32) - mov x4, x0 -1: ldaxr w0, [x4] - stlxr w3, w1, [x4] - cbnz w3, 2f - ret -2: b 1b -END(_atomic_swap_acq_rel_32) - -ATOMIC_OP_ALIAS(atomic_swap_acq_rel_32,_atomic_swap_acq_rel_32) -ATOMIC_OP_ALIAS(__aarch64_swp4_acq_rel,_atomic_swap_acq_rel_32) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_64.S deleted file mode 100644 index f6a45a584342..000000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_64.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_swap_acq_rel_64.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ - -/*- - * Copyright (c) 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_acq_rel_64) - mov x4, x0 -1: ldaxr x0, [x4] - stlxr w3, x1, [x4] - cbnz w3, 2f - ret -2: b 1b -END(_atomic_swap_acq_rel_64) - -ATOMIC_OP_ALIAS(atomic_swap_acq_rel_64,_atomic_swap_acq_rel_64) -ATOMIC_OP_ALIAS(__aarch64_swp8_acq_rel,_atomic_swap_acq_rel_64) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_8.S deleted file mode 100644 index 74bb8ed3dbc7..000000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_acq_rel_8.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_swap_acq_rel_8.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ - -/*- - * Copyright (c) 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_acq_rel_8) - mov x4, x0 -1: ldaxrb w0, [x4] - stlxrb w3, w1, [x4] - cbnz w3, 2f - ret -2: b 1b -END(_atomic_swap_acq_rel_8) - -ATOMIC_OP_ALIAS(atomic_swap_rel_8,_atomic_swap_rel_8) -ATOMIC_OP_ALIAS(__aarch64_swp1_rel,_atomic_swap_rel_8) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_16.S deleted file mode 100644 index 62aef5cf0691..000000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_rel_16.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_swap_rel_16.S,v 1.1 2021/04/21 07:31:37 skrll Exp $ */ - -/*- - * Copyright (c) 2021 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_rel_16) - mov x4, x0 -1: ldxrh w0, [x4] - stlxrh w3, w1, [x4] - cbnz w3, 2f - ret -2: b 1b -END(_atomic_swap_rel_16) - -ATOMIC_OP_ALIAS(atomic_swap_rel_16,_atomic_swap_rel_16) -ATOMIC_OP_ALIAS(__aarch64_swp2_rel,_atomic_swap_rel_16)