Skip to content

Commit

Permalink
Support atomic CAS on no-std pre-v6 ARM using SWP instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Aug 8, 2022
1 parent 25c2957 commit 3f18c62
Show file tree
Hide file tree
Showing 7 changed files with 1,019 additions and 80 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Support atomic CAS on no-std pre-v6 ARM targets (e.g., thumbv4t-none-eabi) under `--cfg portable_atomic_arm_swp_lock`.

## [0.3.10] - 2022-08-03

- Optimize AArch64 128-bit atomic load when the `lse` target feature is enabled at compile-time. ([#20](https://github.com/taiki-e/portable-atomic/pull/20))
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Portable atomic types including support for 128-bit atomics, atomic float, etc.
- Provide `AtomicF32` and `AtomicF64`. (optional)
<!-- - Provide generic `Atomic<T>` type. (optional) -->
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (RISC-V without A-extension, MSP430, AVR)
- Provide atomic CAS for targets where atomic CAS is not available in the standard library. (thumbv6m, RISC-V without A-extension, MSP430, AVR) (optional, [single-core only](#optional-cfg))
- Provide atomic CAS for targets where atomic CAS is not available in the standard library. (thumbv6m, thumbv4t, RISC-V without A-extension, MSP430, AVR) ([optional](#optional-cfg))
- Provide stable equivalents of the standard library atomic types' unstable APIs, such as [`AtomicPtr::fetch_*`](https://github.com/rust-lang/rust/issues/99108), [`AtomicBool::fetch_not`](https://github.com/rust-lang/rust/issues/98485).
- Make features that require newer compilers, such as [fetch_max](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_max), [fetch_min](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_min), [fetch_update](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update), and [stronger CAS failure ordering](https://github.com/rust-lang/rust/pull/98383) available on Rust 1.34+.

Expand Down Expand Up @@ -75,6 +75,15 @@ See [this list](https://github.com/taiki-e/portable-atomic/issues/10#issuecommen

Enabling this cfg for targets that have atomic CAS will result in a compile error.

Supported platforms: ARMv6-M (thumbv6m), RISC-V without A-extension, MSP430, AVR

- **`--cfg portable_atomic_arm_swp_lock`**<br>
Use global lock using `SWP` instruction on pre-v6 ARM targets where atomic CAS is not available in the standard library.

Enabling this cfg for targets that have atomic CAS will result in a compile error.

Supported platforms: pre-v6 ARM (thumbv4t, armv4t, etc.)

## Related Projects

- [atomic-maybe-uninit]: Atomic operations on potentially uninitialized integers.
Expand Down
Loading

0 comments on commit 3f18c62

Please sign in to comment.