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
43
44
/*!
x86/x86_64 architecture memory barrier implementations.
Based on Linux kernel arch/x86/include/asm/barrier.h
Both x86 and x86_64 share the same memory barrier semantics:
- Strong memory ordering model
- Reads are not reordered with other reads
- Writes are not reordered with other writes
- Uses mfence/sfence for full barriers
*/
use asm;
use ;
/// x86/x86_64 read memory barrier implementation.
///
/// On x86/x86_64, reads are not reordered with other reads,
/// so rmb() is just a compiler barrier.
/// x86/x86_64 write memory barrier implementation.
///
/// On x86/x86_64, writes are not reordered with other writes,
/// but we need sfence for certain cases (streaming stores, etc).
/// x86/x86_64 general memory barrier implementation.
///
/// mfence provides a full memory barrier on x86/x86_64.