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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#![allow(unsafe_code)]
use crate::process::Cpuid;
use crate::{backend, io};
pub use backend::process::types::MembarrierCommand;
#[cfg(any(target_os = "android", target_os = "linux"))]
bitflags::bitflags! {
pub struct MembarrierQuery: u32 {
#[doc(alias = "SHARED")]
#[doc(alias = "MEMBARRIER_CMD_SHARED")]
const GLOBAL = MembarrierCommand::Global as _;
const GLOBAL_EXPEDITED = MembarrierCommand::GlobalExpedited as _;
const REGISTER_GLOBAL_EXPEDITED = MembarrierCommand::RegisterGlobalExpedited as _;
const PRIVATE_EXPEDITED = MembarrierCommand::PrivateExpedited as _;
const REGISTER_PRIVATE_EXPEDITED = MembarrierCommand::RegisterPrivateExpedited as _;
const PRIVATE_EXPEDITED_SYNC_CORE = MembarrierCommand::PrivateExpeditedSyncCore as _;
const REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = MembarrierCommand::RegisterPrivateExpeditedSyncCore as _;
const PRIVATE_EXPEDITED_RSEQ = MembarrierCommand::PrivateExpeditedRseq as _;
const REGISTER_PRIVATE_EXPEDITED_RSEQ = MembarrierCommand::RegisterPrivateExpeditedRseq as _;
}
}
#[cfg(any(target_os = "android", target_os = "linux"))]
impl MembarrierQuery {
#[inline]
pub fn contains_command(self, cmd: MembarrierCommand) -> bool {
self.contains(unsafe { Self::from_bits_unchecked(cmd as _) })
}
}
#[inline]
#[doc(alias = "MEMBARRIER_CMD_QUERY")]
pub fn membarrier_query() -> MembarrierQuery {
backend::process::syscalls::membarrier_query()
}
#[inline]
pub fn membarrier(cmd: MembarrierCommand) -> io::Result<()> {
backend::process::syscalls::membarrier(cmd)
}
#[inline]
pub fn membarrier_cpu(cmd: MembarrierCommand, cpu: Cpuid) -> io::Result<()> {
backend::process::syscalls::membarrier_cpu(cmd, cpu)
}