From nobody Tue Aug 09 23:02:47 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M2TB01ZNvz4YcBb; Tue, 9 Aug 2022 23:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M2T9z3fH8z3bXj; Tue, 9 Aug 2022 23:02:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660086167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lD/SS7oclGxigP1ViE6BnHPmNZz2YsCXcf4JRKGWxD0=; b=bu1k3X71kp67oupD1XcT8MFybTzZMRdcQJ3d07ieMNmpZU3F7/GEP6VY/4gix0THmf0z1S uCLfLp8vPJDRBLWBbSNi8BDidM4pKJqFS/LquE3PMQgJ4m9qp08DTfDcd4u4dfeZGW8iv/ VF89bjpKUA+NGviHJgug0xHzTL4VfGaVvBMdYj1Lvgg2gz9DwTyy1/ae29Jdx77+DkE5OG dMf/mryDuqQMxmiikXkMP5lWvXHXumOWHgRrTtjwzBnrin6uuAPMqGFx4xt59okoPdwBIe fA5Uf+BNqrhABv9bAws/5RpkAcQA7YTI5l4rSgSDJZaXRNqxGQ4tJxdU6/m0xQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M2T9z1sDgzq4P; Tue, 9 Aug 2022 23:02:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 279N2l0r082078; Tue, 9 Aug 2022 23:02:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 279N2lW9082077; Tue, 9 Aug 2022 23:02:47 GMT (envelope-from git) Date: Tue, 9 Aug 2022 23:02:47 GMT Message-Id: <202208092302.279N2lW9082077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2bed73739aac - main - atomic: Add plain atomic_load/store_bool() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bed73739aac352299222a18f669a03544c7c9e2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660086167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lD/SS7oclGxigP1ViE6BnHPmNZz2YsCXcf4JRKGWxD0=; b=Qt5hGs5AwdVfwfwmxhajMjYgDfpYXVlBIbCu5ZQfYM/ST6oAKcovvWQaVmtA8xD2DCPfS9 uqjCoNNHP6f4bkymyd83pGzQPIRS4NbGdBzBfrfmUKvN5aCYKTBbExQafa0bWctdswIa0A ieoqPjXZezxkK8hVyjzkSUbHTcujPoJMenmg2r/Tg4DHb86ibz57BqKgUh18LHG27n/E3W 0wYRvu46hiyZMNWwhZAhg692BDcwB/q/NR76y74zLa7CYqBDQ/gtCAFt7Zkr5tchiVzWNI E9S/DZWfQ9cmCu+YHXBtfW2juFSG47xVwKEa+U/UthRFd9Upybkn2PQxVpIgwA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660086167; a=rsa-sha256; cv=none; b=YHT4ll/kxTjskFf6x7iI2ULP4H78f0lOwj1G8rdf15YFTg8W8FIY17mF2IgGnHkULouQ2x E2Cxsa5Fh2v6jl9xliiT4F9nigEym3i0Mu/mT5/Mjnq3wrKMq47iOBtltkTgodDCf481lZ nunpmfWj/F2wUfhPfZv2OK83ZPx/pqWn3KMnZPzZ+K2tj1ChL0aDoLOwQB/4Y95f1XC+R0 jkUM/moUwi/KqP8wRomyiydCDiWYSCEGYsqHv1ly0u1RtI501/jPKkYUG4o8fL/omm91W+ l+/161ovbLjYTdIR35ad6aY6CHEhTmwO/ZmwXtY/0KcA/Bw9Bj/I7bVCL2yZ1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2bed73739aac352299222a18f669a03544c7c9e2 commit 2bed73739aac352299222a18f669a03544c7c9e2 Author: Mark Johnston AuthorDate: 2022-08-09 20:08:29 +0000 Commit: Mark Johnston CommitDate: 2022-08-09 22:34:01 +0000 atomic: Add plain atomic_load/store_bool() Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36078 --- sys/sys/atomic_common.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index a34198fda88a..04281ae8f2ed 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -39,6 +39,10 @@ #include #include +#define __atomic_load_bool_relaxed(p) (*(volatile _Bool *)(p)) +#define __atomic_store_bool_relaxed(p, v) \ + (*(volatile _Bool *)(p) = (_Bool)(v)) + #define __atomic_load_char_relaxed(p) (*(volatile u_char *)(p)) #define __atomic_load_short_relaxed(p) (*(volatile u_short *)(p)) #define __atomic_load_int_relaxed(p) (*(volatile u_int *)(p)) @@ -70,6 +74,11 @@ */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ __has_extension(c_generic_selections) +#define atomic_load_bool(p) \ + _Generic(*(p), _Bool: __atomic_load_bool_relaxed(p)) +#define atomic_store_bool(p, v) \ + _Generic(*(p), _Bool: __atomic_store_bool_relaxed(p, v)) + #define __atomic_load_generic(p, t, ut, n) \ _Generic(*(p), \ t: __atomic_load_ ## n ## _relaxed(p), ut: __atomic_load_ ## n ## _relaxed(p)) @@ -77,6 +86,8 @@ _Generic(*(p), \ t: __atomic_store_ ## n ## _relaxed(p, v), ut: __atomic_store_ ## n ## _relaxed(p, v)) #else +#define atomic_load_bool(p) __atomic_load_bool_relaxed(p) +#define atomic_store_bool(p, v) __atomic_store_bool_relaxed(p, v) #define __atomic_load_generic(p, t, ut, n) __atomic_load_ ## n ## _relaxed(p) #define __atomic_store_generic(p, v, t, ut, n) __atomic_store_ ## n ## _relaxed(p, v) #endif