CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Wed Feb 14 18:00:02 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_load.c Log Message: sprinkle unused. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_load.c 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/atomic
Module Name:src Committed By: christos Date: Wed Feb 14 18:00:02 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_load.c Log Message: sprinkle unused. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_load.c 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/atomic/atomic_load.c diff -u src/common/lib/libc/atomic/atomic_load.c:1.4 src/common/lib/libc/atomic/atomic_load.c:1.5 --- src/common/lib/libc/atomic/atomic_load.c:1.4 Sat Apr 9 19:38:57 2022 +++ src/common/lib/libc/atomic/atomic_load.c Wed Feb 14 13:00:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $ */ +/* $NetBSD: atomic_load.c,v 1.5 2024/02/14 18:00:02 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $"); +__RCSID("$NetBSD: atomic_load.c,v 1.5 2024/02/14 18:00:02 christos Exp $"); #include "atomic_op_namespace.h" @@ -36,8 +36,9 @@ __RCSID("$NetBSD: atomic_load.c,v 1.4 20 #define atomic_load_n(n,b) \ uint ## b ## _t __atomic_load_ ## n(const volatile void *, int); \ +/*ARGSUSED*/ \ uint ## b ## _t \ -__atomic_load_ ## n(const volatile void *ptr, int memmodel) \ +__atomic_load_ ## n(const volatile void *ptr, int memmodel __unused) \ { \ uint## b ##_t val; \ val = *(const volatile uint ## b ## _t *)ptr; \
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Sun Feb 4 16:19:12 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_store.c Log Message: mark unused argument To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_store.c 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/atomic/atomic_store.c diff -u src/common/lib/libc/atomic/atomic_store.c:1.4 src/common/lib/libc/atomic/atomic_store.c:1.5 --- src/common/lib/libc/atomic/atomic_store.c:1.4 Sat Apr 9 19:38:57 2022 +++ src/common/lib/libc/atomic/atomic_store.c Sun Feb 4 11:19:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_store.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $ */ +/* $NetBSD: atomic_store.c,v 1.5 2024/02/04 16:19:12 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_store.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $"); +__RCSID("$NetBSD: atomic_store.c,v 1.5 2024/02/04 16:19:12 christos Exp $"); #include "atomic_op_namespace.h" @@ -36,9 +36,10 @@ __RCSID("$NetBSD: atomic_store.c,v 1.4 2 #define atomic_store_n(n,b) \ void __atomic_store_ ## n(volatile void *, uint ## b ## _t, int); \ +/*ARGSUSED*/ \ void \ __atomic_store_ ## n(volatile void *ptr, uint ## b ## _t val, \ - int memmodel) \ + int memmodel __unused) \ { \ membar_release(); \ *(volatile uint ## b ## _t *)ptr = val; \
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Sun Feb 4 16:19:12 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_store.c Log Message: mark unused argument To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_store.c 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/atomic
Module Name:src Committed By: christos Date: Mon Jan 29 16:09:46 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c Log Message: sprinkle argsused To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c cvs rdiff -u -r1.5 -r1.6 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c 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/atomic
Module Name:src Committed By: christos Date: Mon Jan 29 16:09:46 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c Log Message: sprinkle argsused To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c cvs rdiff -u -r1.5 -r1.6 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c 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/atomic/atomic_c11_compare_exchange_cas_16.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.4 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.5 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.4 Sat May 14 01:35:55 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c Mon Jan 29 11:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.5 2024/01/29 16:09:45 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ bool __atomic_compare_exchange_2(volatil bool, int, int); bool +/*ARGSUSED*/ __atomic_compare_exchange_2(volatile void *mem, void *expected, uint16_t desired, bool weak, int success, int failure) Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.4 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.5 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.4 Sat May 14 01:35:55 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c Mon Jan 29 11:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.5 2024/01/29 16:09:45 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ bool __atomic_compare_exchange_1(volatil bool, int, int); bool +/*ARGSUSED*/ __atomic_compare_exchange_1(volatile void *mem, void *expected, uint8_t desired, bool weak, int success, int failure) Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.5 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.6 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.5 Mon May 16 02:07:23 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Mon Jan 29 11:09:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.5 2022/05/16 06:07:23 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.6 2024/01/29 16:09:45 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ bool __atomic_compare_exchange_4(volatil bool, int, int); bool +/*ARGSUSED*/ __atomic_compare_exchange_4(volatile void *mem, void *expected, uint32_t desired, bool weak, int success, int failure)
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: thorpej Date: Sun Jan 21 03:42:08 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_testset.c Log Message: Catch up with revision 1.5 of atomic_init_cas.c. Fixes building libc on sun2, and probably others. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/common/lib/libc/atomic/atomic_init_testset.c 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/atomic
Module Name:src Committed By: thorpej Date: Sun Jan 21 03:42:08 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_testset.c Log Message: Catch up with revision 1.5 of atomic_init_cas.c. Fixes building libc on sun2, and probably others. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/common/lib/libc/atomic/atomic_init_testset.c 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/atomic/atomic_init_testset.c diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.18 src/common/lib/libc/atomic/atomic_init_testset.c:1.19 --- src/common/lib/libc/atomic/atomic_init_testset.c:1.18 Fri Jan 19 19:33:49 2024 +++ src/common/lib/libc/atomic/atomic_init_testset.c Sun Jan 21 03:42:08 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $ */ +/* $NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,8 +36,9 @@ */ #include -__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $"); +__RCSID("$NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $"); +#include "extern.h" #include "atomic_op_namespace.h" #include
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Fri Jan 19 19:33:49 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_cas.c atomic_init_testset.c Log Message: make decls consistent To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_init_cas.c cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/atomic/atomic_init_testset.c 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/atomic/atomic_init_cas.c diff -u src/common/lib/libc/atomic/atomic_init_cas.c:1.4 src/common/lib/libc/atomic/atomic_init_cas.c:1.5 --- src/common/lib/libc/atomic/atomic_init_cas.c:1.4 Tue Aug 20 23:00:56 2013 +++ src/common/lib/libc/atomic/atomic_init_cas.c Fri Jan 19 14:33:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $ */ +/* $NetBSD: atomic_init_cas.c,v 1.5 2024/01/19 19:33:49 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,11 +32,10 @@ */ #include -__RCSID("$NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $"); +__RCSID("$NetBSD: atomic_init_cas.c,v 1.5 2024/01/19 19:33:49 christos Exp $"); +#include "extern.h" -void __libc_atomic_init(void) __attribute__ ((visibility("hidden"))); - -void __section(".text.startup") +void __section(".text.startup") __attribute__ ((__visibility__("hidden"))) __libc_atomic_init(void) { Index: src/common/lib/libc/atomic/atomic_init_testset.c diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.17 src/common/lib/libc/atomic/atomic_init_testset.c:1.18 --- src/common/lib/libc/atomic/atomic_init_testset.c:1.17 Fri May 15 11:20:40 2020 +++ src/common/lib/libc/atomic/atomic_init_testset.c Fri Jan 19 14:33:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $ */ +/* $NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $"); +__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $"); #include "atomic_op_namespace.h" @@ -98,8 +98,6 @@ static uint8_t (*_atomic_cas_8_fn)(volat _atomic_cas_8_up; RAS_DECL(_atomic_cas_8); -void __libc_atomic_init(void) __attribute__ ((visibility("hidden"))); - #ifndef __HAVE_ASM_ATOMIC_CAS_UP static uint32_t _atomic_cas_up(volatile uint32_t *ptr, uint32_t old, uint32_t new) @@ -276,7 +274,7 @@ _atomic_cas_8(volatile uint8_t *ptr, uin return (*_atomic_cas_8_fn)(ptr, old, new); } -void __section(".text.startup") +void __section(".text.startup") __attribute__ ((__visibility__("hidden"))) __libc_atomic_init(void) { int ncpu, mib[2];
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: christos Date: Fri Jan 19 19:33:49 UTC 2024 Modified Files: src/common/lib/libc/atomic: atomic_init_cas.c atomic_init_testset.c Log Message: make decls consistent To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_init_cas.c cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/atomic/atomic_init_testset.c 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/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 16:45:46 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc atomic: Make previous work a little less accidentally. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/atomic/atomic_is_lock_free.c 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/atomic/atomic_is_lock_free.c diff -u src/common/lib/libc/atomic/atomic_is_lock_free.c:1.2 src/common/lib/libc/atomic/atomic_is_lock_free.c:1.3 --- src/common/lib/libc/atomic/atomic_is_lock_free.c:1.2 Mon Apr 3 08:00:28 2023 +++ src/common/lib/libc/atomic/atomic_is_lock_free.c Mon Apr 3 16:45:46 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $ */ +/* $NetBSD: atomic_is_lock_free.c,v 1.3 2023/04/03 16:45:46 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $"); +__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.3 2023/04/03 16:45:46 riastradh Exp $"); #include @@ -38,9 +38,9 @@ __RCSID("$NetBSD: atomic_is_lock_free.c, * C name be different but using an asm rename to define the right * symbol. */ +bool __atomic_is_lock_free_hack(size_t, const volatile void *) +__RENAME(__atomic_is_lock_free); #define __atomic_is_lock_free __atomic_is_lock_free_hack -bool __atomic_is_lock_free(size_t, const volatile void *) -__RENAME("__atomic_is_lock_free"); bool __atomic_is_lock_free(size_t n, const volatile void *p __unused)
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 16:45:46 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc atomic: Make previous work a little less accidentally. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/atomic/atomic_is_lock_free.c 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/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 08:00:28 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc __atomic_is_lock_free: Fix clang build with symbol hacks. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_is_lock_free.c 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/atomic/atomic_is_lock_free.c diff -u src/common/lib/libc/atomic/atomic_is_lock_free.c:1.1 src/common/lib/libc/atomic/atomic_is_lock_free.c:1.2 --- src/common/lib/libc/atomic/atomic_is_lock_free.c:1.1 Thu Mar 30 15:03:36 2023 +++ src/common/lib/libc/atomic/atomic_is_lock_free.c Mon Apr 3 08:00:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_is_lock_free.c,v 1.1 2023/03/30 15:03:36 riastradh Exp $ */ +/* $NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -27,12 +27,21 @@ */ #include -__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.1 2023/03/30 15:03:36 riastradh Exp $"); +__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $"); #include #include +/* + * XXX Work around clang's built-in __atomic_is_lock_free by having the + * C name be different but using an asm rename to define the right + * symbol. + */ +#define __atomic_is_lock_free __atomic_is_lock_free_hack +bool __atomic_is_lock_free(size_t, const volatile void *) +__RENAME("__atomic_is_lock_free"); + bool __atomic_is_lock_free(size_t n, const volatile void *p __unused) {
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Mon Apr 3 08:00:28 UTC 2023 Modified Files: src/common/lib/libc/atomic: atomic_is_lock_free.c Log Message: libc __atomic_is_lock_free: Fix clang build with symbol hacks. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_is_lock_free.c 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/atomic
Module Name:src Committed By: rin Date: Sun May 29 08:11:15 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_swap_64_cas.c Log Message: One more typo; this is called _atomic_swap_64, not _8. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/atomic/atomic_swap_64_cas.c 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/atomic/atomic_swap_64_cas.c diff -u src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.9 src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.10 --- src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.9 Sat Jun 28 20:18:55 2014 +++ src/common/lib/libc/atomic/atomic_swap_64_cas.c Sun May 29 08:11:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap_64_cas.c,v 1.9 2014/06/28 20:18:55 joerg Exp $ */ +/* $NetBSD: atomic_swap_64_cas.c,v 1.10 2022/05/29 08:11:15 rin Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -47,7 +47,7 @@ atomic_swap_64(volatile uint64_t *addr, return (old); } -crt_alias(__atomic_exchange_8,_atomic_swap_8) +crt_alias(__atomic_exchange_8,_atomic_swap_64) #undef atomic_swap_64 atomic_op_alias(atomic_swap_64,_atomic_swap_64)
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: rin Date: Sun May 29 08:09:19 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_and_64_nv_cas.c Log Message: Fix typo; this is "and", not "add". To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/atomic/atomic_and_64_nv_cas.c 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/atomic/atomic_and_64_nv_cas.c diff -u src/common/lib/libc/atomic/atomic_and_64_nv_cas.c:1.7 src/common/lib/libc/atomic/atomic_and_64_nv_cas.c:1.8 --- src/common/lib/libc/atomic/atomic_and_64_nv_cas.c:1.7 Sat Feb 22 17:08:30 2014 +++ src/common/lib/libc/atomic/atomic_and_64_nv_cas.c Sun May 29 08:09:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_and_64_nv_cas.c,v 1.7 2014/02/22 17:08:30 martin Exp $ */ +/* $NetBSD: atomic_and_64_nv_cas.c,v 1.8 2022/05/29 08:09:19 rin Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ atomic_and_64_nv(volatile uint64_t *addr #undef atomic_and_64_nv atomic_op_alias(atomic_and_64_nv,_atomic_and_64_nv) -crt_alias(__sync_and_and_fetch_8,_atomic_add_64_nv) +crt_alias(__sync_and_and_fetch_8,_atomic_and_64_nv) #if defined(_LP64) #undef atomic_and_ulong_nv
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: rin Date: Sun May 29 08:09:19 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_and_64_nv_cas.c Log Message: Fix typo; this is "and", not "add". To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/atomic/atomic_and_64_nv_cas.c 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/atomic
Module Name:src Committed By: rin Date: Sun May 29 08:11:15 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_swap_64_cas.c Log Message: One more typo; this is called _atomic_swap_64, not _8. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/atomic/atomic_swap_64_cas.c 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/atomic
Module Name:src Committed By: skrll Date: Mon May 16 06:07:23 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_32.c Log Message: Fix the copy&paste botch from previous. Spotted by Tom Lane. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c 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/atomic
Module Name:src Committed By: skrll Date: Mon May 16 06:07:23 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_32.c Log Message: Fix the copy&paste botch from previous. Spotted by Tom Lane. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c 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/atomic/atomic_c11_compare_exchange_cas_32.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.4 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.5 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.4 Sat May 14 05:35:55 2022 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Mon May 16 06:07:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.5 2022/05/16 06:07:23 skrll Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ __atomic_compare_exchange_4(volatile voi * and just do the cas. If we get here the compiler couldn't * do better and it mostly will not matter at all. */ - const uint32_t prev = atomic_cas_8(mem, old, desired); + const uint32_t prev = atomic_cas_32(mem, old, desired); if (prev == old) return true; *ep = prev;
Re: CVS commit: src/common/lib/libc/atomic
On 14/05/2022 06:35, Nick Hudson wrote: Module Name:src Committed By: skrll Date: Sat May 14 05:35:55 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c Commit message should have been lib/56832: __atomic_compare_exchange[_n] is wrong on non-mainstream platforms Make the implementation match the documentation wrt 'expected' This built-in function implements an atomic compare and exchange operation.This compares the contents of *ptr with the contents of *expected. If equal, the operation is a read-modify-write operation that writes desired into *ptr. If they are not equal, the operation is a read and the current contents of *ptr are written into *expected.
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: skrll Date: Sat May 14 05:35:55 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c 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/atomic/atomic_c11_compare_exchange_cas_16.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.3 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.4 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.3 Mon Sep 7 00:52:19 2020 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c Sat May 14 05:35:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -44,12 +44,17 @@ __atomic_compare_exchange_2(volatile voi void *expected, uint16_t desired, bool weak, int success, int failure) { - uint16_t old = *(uint16_t *)expected; + uint16_t * const ep = expected; + const uint16_t old = *ep; /* * Ignore the details (weak, memory model on success and failure) * and just do the cas. If we get here the compiler couldn't * do better and it mostly will not matter at all. */ - return atomic_cas_16(mem, old, desired) == old; + const uint16_t prev = atomic_cas_16(mem, old, desired); + if (prev == old) + return true; + *ep = prev; + return false; } Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.3 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.4 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.3 Mon Sep 7 00:52:19 2020 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Sat May 14 05:35:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -44,12 +44,17 @@ __atomic_compare_exchange_4(volatile voi void *expected, uint32_t desired, bool weak, int success, int failure) { - uint32_t old = *(uint32_t *)expected; + uint32_t * const ep = expected; + const uint32_t old = *ep; /* * Ignore the details (weak, memory model on success and failure) * and just do the cas. If we get here the compiler couldn't * do better and it mostly will not matter at all. */ - return atomic_cas_32(mem, old, desired) == old; + const uint32_t prev = atomic_cas_8(mem, old, desired); + if (prev == old) + return true; + *ep = prev; + return false; } Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.3 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.4 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.3 Mon Sep 7 00:52:19 2020 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c Sat May 14 05:35:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.4 2022/05/14 05:35:55 skrll Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -44,12 +44,17 @@ __atomic_compare_exchange_1(volatile voi void *expected, uint8_t desired, bool weak, int success, int failure) { - uint8_t old = *(uint8_t *)expected; + uint8_t * const ep = expected; + const uint8_t old = *ep; /* * Ignore the details (weak, memory model on success and failure) * and just do the cas. If we get here the compiler couldn't * do better and it mostly will not matter at all. */ - return atomic_cas_8(mem, old, desired) == old; + const uint8_t prev = atomic_cas_8(mem, old, desired); + if (prev == old) + return true; + *ep = prev; + return false; }
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: skrll Date: Sat May 14 05:35:55 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c 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/atomic
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:38:57 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_load.c atomic_store.c Log Message: libc/atomic: Fix membars in __atomic_load/store_* stubs. - membar_enter/exit ordering was backwards. - membar_enter doesn't make any sense for load anyway. - Switch to membar_release for store and membar_acquire for load. The only sensible orderings for a simple load or store are acquire or release, respectively, or sequential consistency. This never provided correct sequential consistency before -- we should really make it conditional on memmodel but I don't know offhand what the values of memmodel might be and this is at least better than before. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/atomic/atomic_load.c \ src/common/lib/libc/atomic/atomic_store.c 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/atomic/atomic_load.c diff -u src/common/lib/libc/atomic/atomic_load.c:1.3 src/common/lib/libc/atomic/atomic_load.c:1.4 --- src/common/lib/libc/atomic/atomic_load.c:1.3 Mon Sep 7 00:52:19 2020 +++ src/common/lib/libc/atomic/atomic_load.c Sat Apr 9 23:38:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_load.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ +/* $NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_load.c,v 1.3 2020/09/07 00:52:19 mrg Exp $"); +__RCSID("$NetBSD: atomic_load.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $"); #include "atomic_op_namespace.h" @@ -40,9 +40,8 @@ uint ## b ## _t \ __atomic_load_ ## n(const volatile void *ptr, int memmodel) \ { \ uint## b ##_t val; \ - membar_enter(); \ val = *(const volatile uint ## b ## _t *)ptr; \ - membar_exit(); \ + membar_acquire(); \ return val; \ } Index: src/common/lib/libc/atomic/atomic_store.c diff -u src/common/lib/libc/atomic/atomic_store.c:1.3 src/common/lib/libc/atomic/atomic_store.c:1.4 --- src/common/lib/libc/atomic/atomic_store.c:1.3 Mon Sep 7 00:52:19 2020 +++ src/common/lib/libc/atomic/atomic_store.c Sat Apr 9 23:38:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_store.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ +/* $NetBSD: atomic_store.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: atomic_store.c,v 1.3 2020/09/07 00:52:19 mrg Exp $"); +__RCSID("$NetBSD: atomic_store.c,v 1.4 2022/04/09 23:38:57 riastradh Exp $"); #include "atomic_op_namespace.h" @@ -40,9 +40,8 @@ void \ __atomic_store_ ## n(volatile void *ptr, uint ## b ## _t val, \ int memmodel) \ { \ - membar_enter(); \ + membar_release(); \ *(volatile uint ## b ## _t *)ptr = val; \ - membar_exit(); \ } atomic_store_n(1, 8)
CVS commit: src/common/lib/libc/atomic
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:38:57 UTC 2022 Modified Files: src/common/lib/libc/atomic: atomic_load.c atomic_store.c Log Message: libc/atomic: Fix membars in __atomic_load/store_* stubs. - membar_enter/exit ordering was backwards. - membar_enter doesn't make any sense for load anyway. - Switch to membar_release for store and membar_acquire for load. The only sensible orderings for a simple load or store are acquire or release, respectively, or sequential consistency. This never provided correct sequential consistency before -- we should really make it conditional on memmodel but I don't know offhand what the values of memmodel might be and this is at least better than before. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/atomic/atomic_load.c \ src/common/lib/libc/atomic/atomic_store.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.