]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
powerpc: Implement atomic_(f)cmpset_ for short and char
authorJustin Hibbits <jhibbits@FreeBSD.org>
Tue, 8 Oct 2019 01:36:34 +0000 (01:36 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Thu, 7 Oct 2021 03:27:26 +0000 (22:27 -0500)
commit168a6eee3a2a6faa8e3eebafe8f1866b2f170727
tree277dfb7b7e9031a8ffffe04d01988c50ed2e05c6
parentfb7485efe6e3bdd171861e4e51425ae46823840d
powerpc: Implement atomic_(f)cmpset_ for short and char

This adds two implementations for each atomic_fcmpset_ and atomic_cmpset_
short and char functions, selectable at compile time for the target
architecture.  By default, it uses a generic shift-and-mask to perform atomic
updates to sub-components of 32-bit words from <sys/_atomic_subword.h>.
However, if ISA_206_ATOMICS is defined it uses the ll/sc instructions for
halfword and bytes, introduced in PowerISA 2.06.  These instructions are
supported by all IBM processors from POWER7 on, as well as the Freescale/NXP
e6500 core.  Although the e5500 and e500mc both implement PowerISA 2.06 they
do not implement these instructions.

As part of this, clean up the atomic_(f)cmpset_acq and _rel wrappers, by
using macros to reduce code duplication.

ISA_206_ATOMICS requires clang or newer binutils (2.20 or later).

(cherry picked from commit 84046d16eba76392ece41452b6ca3bd5808a1d19)
sys/powerpc/include/atomic.h