aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2020-03-25 23:12:43 +0000
committerConrad Meyer <cem@FreeBSD.org>2020-03-25 23:12:43 +0000
commitca0ec73c11a7bb9ed409466e514fa5c34b6c84b5 (patch)
tree1c9d3998c7f4e86682b2df777ce0de2fc29d17c4 /sys/i386
parent9b2877353b7c371a7964825e3ab2c983d09c0a46 (diff)
downloadsrc-ca0ec73c11a7bb9ed409466e514fa5c34b6c84b5.tar.gz
src-ca0ec73c11a7bb9ed409466e514fa5c34b6c84b5.zip
Expand generic subword atomic primitives
The goal of this change is to make the atomic_load_acq_{8,16}, atomic_testandset{,_acq}_long, and atomic_testandclear_long primitives available in MI-namespace. The second goal is to get this draft out of my local tree, as anything that requires a full tinderbox is a big burden out of tree. MD specifics can be refined individually afterwards. The generic implementations may not be ideal for your architecture; feel free to implement better versions. If no subword_atomic definitions are needed, the include can be removed from your arch's machine/atomic.h. Generic definitions are guarded by defined macros of the same name. To avoid picking up conflicting generic definitions, some macro defines are added to various MD machine/atomic.h to register an existing implementation. Include _atomic_subword.h in arm and arm64 machine/atomic.h. For some odd reason, KCSAN only generates some versions of primitives. Generate the _acq variants of atomic_load.*_8, atomic_load.*_16, and atomic_testandset.*_long. There are other questionably disabled primitives, but I didn't run into them, so I left them alone. KCSAN is only built for amd64 in tinderbox for now. Add atomic_subword implementations of atomic_load_acq_{8,16} implemented using masking and atomic_load_acq_32. Add generic atomic_subword implementations of atomic_testandset_long(), atomic_testandclear_long(), and atomic_testandset_acq_long(), using atomic_fcmpset_long() and atomic_fcmpset_acq_long(). On x86, add atomic_testandset_acq_long as an alias for atomic_testandset_long. Reviewed by: kevans, rlibby (previous versions both) Differential Revision: https://reviews.freebsd.org/D22963
Notes
Notes: svn path=/head/; revision=359311
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/include/atomic.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h
index bd6da487e6a9..14fa3040341c 100644
--- a/sys/i386/include/atomic.h
+++ b/sys/i386/include/atomic.h
@@ -808,6 +808,7 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
#define atomic_readandclear_int(p) atomic_swap_int(p, 0)
#define atomic_readandclear_long(p) atomic_swap_long(p, 0)
+#define atomic_testandset_acq_long atomic_testandset_long
/* Operations on 8-bit bytes. */
#define atomic_set_8 atomic_set_char