1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*!
RISC-V architecture memory barrier implementations.
Based on Linux kernel arch/riscv/include/asm/barrier.h
Both RISC-V 32-bit and 64-bit share the same memory barrier semantics:
- Relaxed memory model requiring explicit ordering
- Uses FENCE instruction with r,r / w,w / rw,rw ordering
- Same instruction set for memory barriers
*/
use asm;
/// RISC-V read memory barrier implementation.
///
/// Uses FENCE instruction with r,r (read-read) ordering.
/// RISC-V write memory barrier implementation.
///
/// Uses FENCE instruction with w,w (write-write) ordering.
/// RISC-V general memory barrier implementation.
///
/// Uses FENCE instruction with rw,rw (read-write, read-write) ordering.