]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r352938:
authorIan Lepore <ian@FreeBSD.org>
Sat, 7 Dec 2019 17:34:04 +0000 (17:34 +0000)
committerIan Lepore <ian@FreeBSD.org>
Sat, 7 Dec 2019 17:34:04 +0000 (17:34 +0000)
commit3775d47262330136ea8e44190a720a355f8c02c6
tree135df30a4d7c14001cefaf6027eff128169bceec
parentc8be2e8baa5fcb0613e5356c26f07b0d7b74deb9
MFC r352938:

Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm.

This adds 8 and 16 bit versions of the cmpset and fcmpset functions. Macros
are used to generate all the flavors from the same set of instructions; the
macro expansion handles the couple minor differences between each size
variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc).

In addition to handling new sizes, the instruction sequences used for cmpset
and fcmpset are rewritten to be a bit shorter/faster, and the new sequence
will not return false when *dst==*old but the store-exclusive fails because
of concurrent writers. Instead, it just loops like ldrex/strex sequences
normally do until it gets a non-conflicted store. The manpage allows LL/SC
architectures to bogusly return false, but there's no reason to actually do
so, at least on arm.

Reviewed by: cognet
sys/arm/include/atomic-v4.h
sys/arm/include/atomic-v6.h