CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: riastradh Date: Sat Apr 9 22:53:17 UTC 2022 Modified Files: src/common/lib/libc/arch/sparc/atomic: membar_ops.S Log Message: sparc/membar_ops: Upgrade membar_enter from R/RW to RW/RW. This will be deprecated soon but let's avoid leaving rakes to trip on with it arising from disagreement over the documentation (W/RW) and implementation and usage (R/RW). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/sparc/atomic/membar_ops.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/membar_ops.S diff -u src/common/lib/libc/arch/sparc/atomic/membar_ops.S:1.6 src/common/lib/libc/arch/sparc/atomic/membar_ops.S:1.7 --- src/common/lib/libc/arch/sparc/atomic/membar_ops.S:1.6 Sat Apr 9 12:06:39 2022 +++ src/common/lib/libc/arch/sparc/atomic/membar_ops.S Sat Apr 9 22:53:17 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: membar_ops.S,v 1.6 2022/04/09 12:06:39 riastradh Exp $ */ +/* $NetBSD: membar_ops.S,v 1.7 2022/04/09 22:53:17 riastradh Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -39,10 +39,10 @@ /* * These assume Total Store Order (TSO), which may reorder - * store-before-load but nothing else. Hence, only membar_sync must - * issue anything -- specifically, an LDSTUB, which (along with SWAP) - * is the only instruction that implies a sequential consistency - * barrier. + * store-before-load but nothing else. Hence, only membar_sync (and + * its deprecated alias membar_enter) must issue anything -- + * specifically, an LDSTUB, which (along with SWAP) is the only + * instruction that implies a sequential consistency barrier. * * If we ran with Partial Store Order (PSO), we would also need to * issue STBAR for membar_exit (load/store-before-store) and @@ -66,8 +66,8 @@ END(_membar_sync) ATOMIC_OP_ALIAS(membar_producer,_membar_consumer) STRONG_ALIAS(_membar_producer,_membar_consumer) ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) -ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_enter,_membar_consumer) +ATOMIC_OP_ALIAS(membar_enter,_membar_sync) +STRONG_ALIAS(_membar_enter,_membar_sync) ATOMIC_OP_ALIAS(membar_exit,_membar_consumer) STRONG_ALIAS(_membar_exit,_membar_consumer) ATOMIC_OP_ALIAS(membar_sync,_membar_sync)
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: riastradh Date: Sat Apr 9 22:53:17 UTC 2022 Modified Files: src/common/lib/libc/arch/sparc/atomic: membar_ops.S Log Message: sparc/membar_ops: Upgrade membar_enter from R/RW to RW/RW. This will be deprecated soon but let's avoid leaving rakes to trip on with it arising from disagreement over the documentation (W/RW) and implementation and usage (R/RW). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/sparc/atomic/membar_ops.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: riastradh Date: Sat Apr 9 12:06:39 UTC 2022 Modified Files: src/common/lib/libc/arch/sparc/atomic: membar_ops.S Log Message: sparc: Fix membar_sync with LDSTUB. membar_sync is required to be a full sequential consistency barrier, equivalent to MEMBAR #StoreStore|LoadStore|StoreLoad|LoadLoad on sparcv9. LDSTUB and SWAP are the only pre-v9 instructions that do this and SWAP doesn't exist on all v7 hardware, so use LDSTUB. Note: I'm having a hard time nailing down a reference for the ordering implied by LDSTUB and SWAP. I'm _pretty sure_ SWAP has to imply store-load ordering since the SPARCv8 manual recommends it for Dekker's algorithm (which notoriously requires store-load ordering), and the formal memory model treats LDSTUB and SWAP the same for ordering. But the v8 and v9 manuals aren't clear. GCC issues STBAR and LDSTUB, but (a) I don't see why STBAR is necessary here, (b) STBAR doesn't exist on v7 so it'd be a pain to use, and (c) from what I've heard (although again it's hard to nail down authoritative references here) all actual SPARC hardware is TSO or SC anyway so STBAR is a noop in all the silicon anyway. Either way, certainly this is better than what we had before, which was nothing implying ordering at all, just a store! To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/sparc/atomic/membar_ops.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: riastradh Date: Sat Apr 9 12:06:39 UTC 2022 Modified Files: src/common/lib/libc/arch/sparc/atomic: membar_ops.S Log Message: sparc: Fix membar_sync with LDSTUB. membar_sync is required to be a full sequential consistency barrier, equivalent to MEMBAR #StoreStore|LoadStore|StoreLoad|LoadLoad on sparcv9. LDSTUB and SWAP are the only pre-v9 instructions that do this and SWAP doesn't exist on all v7 hardware, so use LDSTUB. Note: I'm having a hard time nailing down a reference for the ordering implied by LDSTUB and SWAP. I'm _pretty sure_ SWAP has to imply store-load ordering since the SPARCv8 manual recommends it for Dekker's algorithm (which notoriously requires store-load ordering), and the formal memory model treats LDSTUB and SWAP the same for ordering. But the v8 and v9 manuals aren't clear. GCC issues STBAR and LDSTUB, but (a) I don't see why STBAR is necessary here, (b) STBAR doesn't exist on v7 so it'd be a pain to use, and (c) from what I've heard (although again it's hard to nail down authoritative references here) all actual SPARC hardware is TSO or SC anyway so STBAR is a noop in all the silicon anyway. Either way, certainly this is better than what we had before, which was nothing implying ordering at all, just a store! To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/sparc/atomic/membar_ops.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/membar_ops.S diff -u src/common/lib/libc/arch/sparc/atomic/membar_ops.S:1.5 src/common/lib/libc/arch/sparc/atomic/membar_ops.S:1.6 --- src/common/lib/libc/arch/sparc/atomic/membar_ops.S:1.5 Wed Apr 6 22:47:56 2022 +++ src/common/lib/libc/arch/sparc/atomic/membar_ops.S Sat Apr 9 12:06:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: membar_ops.S,v 1.5 2022/04/06 22:47:56 riastradh Exp $ */ +/* $NetBSD: membar_ops.S,v 1.6 2022/04/09 12:06:39 riastradh Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -31,25 +31,43 @@ #include "atomic_op_asm.h" +#ifdef _KERNEL_OPT +#include "opt_multiprocessor.h" +#endif + .text -/* These assume Total Store Order (TSO) */ +/* + * These assume Total Store Order (TSO), which may reorder + * store-before-load but nothing else. Hence, only membar_sync must + * issue anything -- specifically, an LDSTUB, which (along with SWAP) + * is the only instruction that implies a sequential consistency + * barrier. + * + * If we ran with Partial Store Order (PSO), we would also need to + * issue STBAR for membar_exit (load/store-before-store) and + * membar_producer (store-before-store). + */ -ENTRY(_membar_producer) +ENTRY(_membar_consumer) retl nop +END(_membar_consumer) -ENTRY(_membar_consumer) - add %sp, -112, %sp - st %g0, [%sp+100] +ENTRY(_membar_sync) retl - sub %sp, -112, %sp +#if !defined(_KERNEL) || defined(MULTIPROCESSOR) + ldstub [%sp - 4], %g0 +#else + nop +#endif +END(_membar_sync) -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) +ATOMIC_OP_ALIAS(membar_producer,_membar_consumer) +STRONG_ALIAS(_membar_producer,_membar_consumer) ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) STRONG_ALIAS(_membar_enter,_membar_consumer) ATOMIC_OP_ALIAS(membar_exit,_membar_consumer) STRONG_ALIAS(_membar_exit,_membar_consumer) -ATOMIC_OP_ALIAS(membar_sync,_membar_consumer) -STRONG_ALIAS(_membar_sync,_membar_consumer) +ATOMIC_OP_ALIAS(membar_sync,_membar_sync)
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: nakayama Date: Sun May 29 05:10:34 UTC 2016 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: Use sparc64 code always on 32-bit sparc64 kernels since %psr read/write instructions used in sparc's atomic_cas.S don't exist in SPARC-V9. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.21 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.22 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.21 Sat Feb 27 19:19:33 2016 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Sun May 29 05:10:34 2016 @@ -1,10 +1,11 @@ -# $NetBSD: Makefile.inc,v 1.21 2016/02/27 19:19:33 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.22 2016/05/29 05:10:34 nakayama Exp $ .include # This is called with MACHINE=sparc64 && MACHINE_ARCH=sparc when building # 32 bit kernels for ultrasparc hardware -.if ${MACHINE} == "sparc64" && ${HAVE_LLVM:Uno} == "no" +.if ${MACHINE} == "sparc64" && \ + (${HAVE_LLVM:Uno} == "no" || (defined(LIB) && ${LIB} == "kern")) SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic .PATH.c: ${SPARC64DIR}
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: nakayama Date: Sun May 29 05:10:34 UTC 2016 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: Use sparc64 code always on 32-bit sparc64 kernels since %psr read/write instructions used in sparc's atomic_cas.S don't exist in SPARC-V9. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: joerg Date: Sat Feb 27 19:19:33 UTC 2016 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: When using clang, do not use the sparc64 code as it doesn't provide the full set of symbols and clang in -m32 defaults to sparcv8, not sparcv8plus. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.20 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.21 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.20 Sat Feb 27 19:18:29 2016 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Sat Feb 27 19:19:33 2016 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.20 2016/02/27 19:18:29 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.21 2016/02/27 19:19:33 joerg Exp $ .include # This is called with MACHINE=sparc64 && MACHINE_ARCH=sparc when building # 32 bit kernels for ultrasparc hardware -.if ${MACHINE} == "sparc64" +.if ${MACHINE} == "sparc64" && ${HAVE_LLVM:Uno} == "no" SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic .PATH.c: ${SPARC64DIR}
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: joerg Date: Sat Feb 27 19:19:33 UTC 2016 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: When using clang, do not use the sparc64 code as it doesn't provide the full set of symbols and clang in -m32 defaults to sparcv8, not sparcv8plus. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: joerg Date: Sat Feb 27 19:18:29 UTC 2016 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: Include C11 load/store helpers. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.19 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.20 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.19 Sun Oct 18 02:28:07 2015 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Sat Feb 27 19:18:29 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.19 2015/10/18 02:28:07 nakayama Exp $ +# $NetBSD: Makefile.inc,v 1.20 2016/02/27 19:18:29 joerg Exp $ .include @@ -43,7 +43,8 @@ SRCS+= atomic_nand_16_cas.c atomic_nand_ atomic_swap_16_cas.c atomic_swap_8_cas.c \ atomic_c11_compare_exchange_cas_32.c \ atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c + atomic_c11_compare_exchange_cas_8.c \ + atomic_load.c atomic_store.c . endif . if (${LIB} == "kern" || ${LIB} == "rump")
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: joerg Date: Sat Feb 27 19:18:29 UTC 2016 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: Include C11 load/store helpers. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Mon Oct 13 08:59:41 UTC 2014 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: Add C++ 2011 atomic support functions. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.17 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.18 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.17 Fri Feb 21 16:21:02 2014 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Mon Oct 13 08:59:41 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.17 2014/02/21 16:21:02 martin Exp $ +# $NetBSD: Makefile.inc,v 1.18 2014/10/13 08:59:41 martin Exp $ .include bsd.own.mk @@ -34,7 +34,10 @@ SRCS+= atomic_nand_16_cas.c atomic_nand_ atomic_cas_16_cas.c atomic_cas_8_cas.c \ atomic_sub_16_cas.c atomic_sub_8_cas.c \ atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c + atomic_swap_16_cas.c atomic_swap_8_cas.c \ + atomic_c11_compare_exchange_cas_32.c \ + atomic_c11_compare_exchange_cas_16.c \ + atomic_c11_compare_exchange_cas_8.c . endif . if (${LIB} == kern || ${LIB} == rump)
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Mon Oct 13 08:59:41 UTC 2014 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Log Message: Add C++ 2011 atomic support functions. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/arch/sparc/atomic/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Fri Feb 21 16:21:02 UTC 2014 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc atomic_cas.S Log Message: Provide the missing __sync_* ops for sparc. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.16 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.17 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.16 Wed Jan 29 13:06:36 2014 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Fri Feb 21 16:21:02 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.16 2014/01/29 13:06:36 martin Exp $ +# $NetBSD: Makefile.inc,v 1.17 2014/02/21 16:21:02 martin Exp $ .include bsd.own.mk @@ -21,7 +21,20 @@ SPARC64DIR= ${.PARSEDIR}/../../sparc64/a SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ - atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops.S + atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops.S \ + atomic_cas_32_cas.c atomic_nand_32_cas.c atomic_sub_32_cas.c \ + atomic_xor_32_cas.c +. endif + +. if ${LIB} == c +SRCS+= atomic_nand_16_cas.c atomic_nand_8_cas.c \ + atomic_and_16_cas.c atomic_and_8_cas.c \ + atomic_xor_16_cas.c atomic_xor_8_cas.c \ + atomic_add_16_cas.c atomic_add_8_cas.c \ + atomic_cas_16_cas.c atomic_cas_8_cas.c \ + atomic_sub_16_cas.c atomic_sub_8_cas.c \ + atomic_or_16_cas.c atomic_or_8_cas.c \ + atomic_swap_16_cas.c atomic_swap_8_cas.c . endif . if (${LIB} == kern || ${LIB} == rump) Index: src/common/lib/libc/arch/sparc/atomic/atomic_cas.S diff -u src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.12 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.13 --- src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.12 Thu Sep 12 15:36:14 2013 +++ src/common/lib/libc/arch/sparc/atomic/atomic_cas.S Fri Feb 21 16:21:02 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas.S,v 1.12 2013/09/12 15:36:14 joerg Exp $ */ +/* $NetBSD: atomic_cas.S,v 1.13 2014/02/21 16:21:02 martin Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -147,6 +147,7 @@ ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) +STRONG_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Fri Feb 21 16:21:02 UTC 2014 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc atomic_cas.S Log Message: Provide the missing __sync_* ops for sparc. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Wed Jan 29 13:06:36 UTC 2014 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc atomic_cas_up.S Log Message: Provide _atomic_cas_{16,8}_up To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r1.1 -r1.2 \ src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.15 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.16 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.15 Wed Nov 28 21:39:59 2012 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Wed Jan 29 13:06:36 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.15 2012/11/28 21:39:59 martin Exp $ +# $NetBSD: Makefile.inc,v 1.16 2014/01/29 13:06:36 martin Exp $ .include bsd.own.mk @@ -29,7 +29,8 @@ SRCS+= atomic_cas.S . endif . if (${LIB} == c || ${LIB} == pthread) -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP +CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -D__HAVE_ASM_ATOMIC_CAS_16_UP \ + -D__HAVE_ASM_ATOMIC_CAS_8_UP SRCS+= atomic_init_testset.c atomic_cas_up.S . endif Index: src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S diff -u src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S:1.1 src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S:1.2 --- src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S:1.1 Wed Nov 28 21:39:59 2012 +++ src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S Wed Jan 29 13:06:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas_up.S,v 1.1 2012/11/28 21:39:59 martin Exp $ */ +/* $NetBSD: atomic_cas_up.S,v 1.2 2014/01/29 13:06:36 martin Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -43,3 +43,27 @@ RAS_END_ASM_HIDDEN(_atomic_cas) retl mov %o3, %o0 ! return old value +ENTRY(_atomic_cas_16_up) + .hidden _C_LABEL(_atomic_cas_16_up) +RAS_START_ASM_HIDDEN(_atomic_cas_16) + lduh [%o0], %o3 ! get old value + cmp %o1, %o3 ! old == new? + beq,a 1f! yes, do the store + sth %o2, [%o0] ! (in the delay slot) +RAS_END_ASM_HIDDEN(_atomic_cas_16) +1: + retl + mov %o3, %o0 ! return old value + +ENTRY(_atomic_cas_8_up) + .hidden _C_LABEL(_atomic_cas_8_up) +RAS_START_ASM_HIDDEN(_atomic_cas_8) + ldub [%o0], %o3 ! get old value + cmp %o1, %o3 ! old == new? + beq,a 1f! yes, do the store + stb %o2, [%o0] ! (in the delay slot) +RAS_END_ASM_HIDDEN(_atomic_cas_8) +1: + retl + mov %o3, %o0 ! return old value +
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Wed Jan 29 13:06:36 UTC 2014 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc atomic_cas_up.S Log Message: Provide _atomic_cas_{16,8}_up To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r1.1 -r1.2 \ src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Wed Nov 28 21:39:59 UTC 2012 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Added Files: src/common/lib/libc/arch/sparc/atomic: atomic_cas_up.S Log Message: Provide an assembler version of _atomic_cas_up for sparc - the C code does not compile to something usable in a RAS. See PR 38482. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.14 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.15 --- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.14 Fri Mar 13 19:16:46 2009 +++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc Wed Nov 28 21:39:59 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.14 2009/03/13 19:16:46 abs Exp $ +# $NetBSD: Makefile.inc,v 1.15 2012/11/28 21:39:59 martin Exp $ .include bsd.own.mk @@ -29,7 +29,8 @@ SRCS+= atomic_cas.S . endif . if (${LIB} == c || ${LIB} == pthread) -SRCS+= atomic_init_testset.c +CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP +SRCS+= atomic_init_testset.c atomic_cas_up.S . endif . endif Added files: Index: src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S diff -u /dev/null src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S:1.1 --- /dev/null Wed Nov 28 21:39:59 2012 +++ src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S Wed Nov 28 21:39:59 2012 @@ -0,0 +1,45 @@ +/* $NetBSD: atomic_cas_up.S,v 1.1 2012/11/28 21:39:59 martin Exp $ */ + +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * 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 sys/ras.h +#include atomic_op_asm.h + + .text + +ENTRY(_atomic_cas_up) + .hidden _C_LABEL(_atomic_cas_up) +RAS_START_ASM_HIDDEN(_atomic_cas) + ld [%o0], %o3 ! get old value + cmp %o1, %o3 ! old == new? + beq,a 1f! yes, do the store + st %o2, [%o0] ! (in the delay slot) +RAS_END_ASM_HIDDEN(_atomic_cas) +1: + retl + mov %o3, %o0 ! return old value +
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: martin Date: Wed Nov 28 21:39:59 UTC 2012 Modified Files: src/common/lib/libc/arch/sparc/atomic: Makefile.inc Added Files: src/common/lib/libc/arch/sparc/atomic: atomic_cas_up.S Log Message: Provide an assembler version of _atomic_cas_up for sparc - the C code does not compile to something usable in a RAS. See PR 38482. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/arch/sparc/atomic/Makefile.inc cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: pooka Date: Tue Feb 22 18:45:10 UTC 2011 Modified Files: src/common/lib/libc/arch/sparc/atomic: atomic_cas.S Log Message: Add PIC variant for fetching the lock address. librump.so now works on sparc To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/sparc/atomic/atomic_cas.S diff -u src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.10 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.11 --- src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.10 Fri Mar 13 16:40:22 2009 +++ src/common/lib/libc/arch/sparc/atomic/atomic_cas.S Tue Feb 22 18:45:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas.S,v 1.10 2009/03/13 16:40:22 nakayama Exp $ */ +/* $NetBSD: atomic_cas.S,v 1.11 2011/02/22 18:45:10 pooka Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -63,15 +63,29 @@ #if defined(MULTIPROCESSOR) .section .bss .align 1024 +#ifdef PIC + .globl _C_LABEL(_atomic_cas_locktab) +#endif OTYPE(_C_LABEL(_atomic_cas_locktab)) _C_LABEL(_atomic_cas_locktab): .space 1024 +#ifdef PIC +/* o4 is not used for PSR in PIC cases, so we can use it here */ +#define GETLOCKTAB \ + PIC_PROLOGUE(%o3,%o4) ;\ + set _C_LABEL(_atomic_cas_locktab), %o4;\ + ld [%o3 + %o4], %o3 +#else +#define GETLOCKTAB \ + sethi %hi(_C_LABEL(_atomic_cas_locktab)), %o3 +#endif + #define ACQUIRE_INTERLOCK \ DISABLE_INTERRUPTS ;\ srl %o0, 3, %o5 /* get lock address */ ;\ and %o5, 1023, %o5 ;\ - sethi %hi(_C_LABEL(_atomic_cas_locktab)), %o3 ;\ + GETLOCKTAB ;\ add %o5, %o3, %o5 ;\ ;\ /* %o5 has interlock address */ ;\
CVS commit: src/common/lib/libc/arch/sparc/atomic
Module Name:src Committed By: pooka Date: Tue Feb 22 18:45:10 UTC 2011 Modified Files: src/common/lib/libc/arch/sparc/atomic: atomic_cas.S Log Message: Add PIC variant for fetching the lock address. librump.so now works on sparc To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.