Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"ignorePaths": [
"target-specs/**",
"tools/valgrind/**",
"tests/asm-test/asm/**"
"tests/asm-test/asm/**",
"tests/bpf/LICENSE-*"
]
}
10 changes: 10 additions & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ balign
beqz
beqzc
Bicc
bindeps
bnez
boundedly
brne
Expand Down Expand Up @@ -45,6 +46,7 @@ DWCAS
eors
espup
fild
filosottile
fistp
fstat
gaisler
Expand All @@ -53,9 +55,11 @@ gettime
GRLIB
Halfword
hwsync
iface
IMAFD
inequal
insertnopload
insn
ishld
isync
kuser
Expand Down Expand Up @@ -89,8 +93,10 @@ lwarx
lwsync
mcpu
membar
memcg
memcheck
memd
memlock
memw
mfcr
mfence
Expand Down Expand Up @@ -118,6 +124,8 @@ qbsp
quadword
rcpc
risbg
rlim
rlimit
rsbegin
rsend
RVWMO
Expand All @@ -128,6 +136,7 @@ SCWP
SCWPE
seqz
sete
setrlimit
signedness
simavr
simio
Expand Down Expand Up @@ -169,6 +178,7 @@ versatilepb
virt
vmovdqa
wokwi
wreg
xadd
xchg
xgetbv
Expand Down
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ updates:
# crates with [workspace] table are not recognized by the above 'directory: /'
- /tests/asm-test
- /tests/avr
- /tests/bpf
- /tests/msp430
- /tests/no-std-linux
- /tests/no-std-qemu
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,10 @@ jobs:
tool: cargo-hack,espup
fallback: none
if: matrix.rust == 'stable'
- uses: taiki-e/cache-cargo-install-action@a8b9ecf8e0c0ea09d7481cfc583a5203ecd585b5 # v3.0.5
with:
tool: bpf-linker
if: matrix.rust == 'nightly'
- run: |
retry() {
for i in {1..10}; do
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This crate provides a way to soundly perform such operations.

## Platform Support

Currently, all CPU architectures supported by Rust (x86, x86_64, Arm, AArch64, Arm64EC, RISC-V, LoongArch, s390x, PowerPC, MIPS, SPARC, AVR, MSP430, Hexagon, M68k, C-SKY, and Xtensa) are supported.
Currently, all CPU architectures supported by Rust (x86, x86_64, Arm, AArch64, Arm64EC, RISC-V, LoongArch, s390x, PowerPC, MIPS, SPARC, AVR, MSP430, Hexagon, M68k, C-SKY, and Xtensa) and BPF are supported.
(You can use `cfg_{has,no}_*` macros to write code based on which primitive sizes are available for the current target and Rust version.)

| target_arch | primitives | load/store | swap/CAS |
Expand Down Expand Up @@ -53,6 +53,8 @@ Currently, all CPU architectures supported by Rust (x86, x86_64, Arm, AArch64, A
| m68k (+isa-68020) \[9] \[13] (experimental) | i64,u64 | ✓ | ✓ |
| csky \[13] (experimental) | isize,usize,i8,u8,i16,u16,i32,u32 | ✓ | ✓\[1] |
| xtensa \[13] (experimental) | isize,usize,i8,u8,i16,u16,i32,u32 | ✓ | ✓\[1] |
| bpf \[13] (experimental) | isize,usize,i64,u64 | ✓ | ✓ |
| bpf (+alu32) \[13] \[14] (experimental) | i32,u32 | ✓ | ✓ |

\[1] Arm's RMW operations are not available on Armv6-M (thumbv6m). RISC-V's RMW operations are not available on targets without the A (or G which means IMAFD) or Zalrsc or Zacas extension, such as riscv32i, riscv32imc, etc. 32-bit SPARC's RMW operations requires `v9` or `leoncasa` target feature (enabled by default on Linux). M68k's atomic RMW operations requires target-cpu M68020+ (enabled by default on Linux). C-SKY's atomic RMW operations requires target-cpu ck860\* or c860\* (enabled by default on the hard-float target). Xtensa's atomic RMW operations are not available on esp32s2.<br>
\[2] Requires `cmpxchg16b` target feature (enabled by default on Apple, Windows (except Windows 7), and Fuchsia targets).<br>
Expand All @@ -65,6 +67,7 @@ Currently, all CPU architectures supported by Rust (x86, x86_64, Arm, AArch64, A
\[11] Requires Rust 1.91+.<br>
\[12] Requires Rust 1.95+.<br>
\[13] Requires nightly due to `#![feature(asm_experimental_arch)]`.<br>
\[14] Requires `alu32` target feature.<br>
<!-- loongarch64: \[5] Requires `scq` target feature.<br> -->
<!-- mips32r6/mips64r6: \[7] Requires Release 6 Paired LL/SC family of instructions.<br> -->

Expand Down
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ fn main() {
}
}
}
"avr" | "m68k" | "mips" | "mips32r6" | "mips64" | "mips64r6" | "msp430" | "xtensa" => {
"avr" | "bpf" | "m68k" | "mips" | "mips32r6" | "mips64" | "mips64r6" | "msp430"
| "xtensa" => {
if version.nightly && is_allowed_feature("asm_experimental_arch") {
println!("cargo:rustc-cfg=atomic_maybe_uninit_unstable_asm_experimental_arch");
}
Expand Down
8 changes: 8 additions & 0 deletions src/arch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This document describes the operations that are considered atomic by architectur
- [AArch64](#aarch64)
- [Arm](#arm)
- [AVR](#avr)
- [BPF](#bpf)
- [C-SKY](#c-sky)
- [Hexagon](#hexagon)
- [LoongArch](#loongarch)
Expand Down Expand Up @@ -64,6 +65,13 @@ This architecture is always single-core and the following operations are atomic:
disabling and restoring implementation must imply compiler fences, e.g., asm without nomem/readonly)
may be moved out of the critical section by compiler optimizations.

## BPF

target_arch: bpf<br>
Implementation: [bpf.rs](bpf.rs)<br>

TODO: reference and overview

## C-SKY

target_arch: csky<br>
Expand Down
Loading