]> git.proxmox.com Git - rustc.git/blame - src/stdarch/crates/core_arch/src/acle/registers/mod.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / stdarch / crates / core_arch / src / acle / registers / mod.rs
CommitLineData
532ac7d7
XL
1#[allow(unused_macros)]
2macro_rules! rsr {
3 ($R:ident) => {
4 impl super::super::sealed::Rsr for $R {
5 unsafe fn __rsr(&self) -> u32 {
6 let r: u32;
ba9703b0 7 llvm_asm!(concat!("mrs $0,", stringify!($R)) : "=r"(r) : : : "volatile");
532ac7d7
XL
8 r
9 }
10 }
11 };
12}
13
14#[allow(unused_macros)]
15macro_rules! rsrp {
16 ($R:ident) => {
17 impl super::super::sealed::Rsrp for $R {
18 unsafe fn __rsrp(&self) -> *const u8 {
19 let r: *const u8;
ba9703b0 20 llvm_asm!(concat!("mrs $0,", stringify!($R)) : "=r"(r) : : : "volatile");
532ac7d7
XL
21 r
22 }
23 }
24 };
25}
26
27#[allow(unused_macros)]
28macro_rules! wsr {
29 ($R:ident) => {
30 impl super::super::sealed::Wsr for $R {
31 unsafe fn __wsr(&self, value: u32) {
ba9703b0 32 llvm_asm!(concat!("msr ", stringify!($R), ",$0") : : "r"(value) : : "volatile");
532ac7d7
XL
33 }
34 }
35 };
36}
37
38#[allow(unused_macros)]
39macro_rules! wsrp {
40 ($R:ident) => {
41 impl super::super::sealed::Wsrp for $R {
42 unsafe fn __wsrp(&self, value: *const u8) {
ba9703b0 43 llvm_asm!(concat!("msr ", stringify!($R), ",$0") : : "r"(value) : : "volatile");
532ac7d7
XL
44 }
45 }
46 };
47}
48
49#[cfg(target_feature = "mclass")]
50mod v6m;
51
52#[cfg(target_feature = "mclass")]
53pub use self::v6m::*;
54
55#[cfg(all(target_feature = "v7", target_feature = "mclass"))]
56mod v7m;
57
58#[cfg(all(target_feature = "v7", target_feature = "mclass"))]
59pub use self::v7m::*;
60
61#[cfg(not(target_arch = "aarch64"))]
62mod aarch32;
63
64#[cfg(not(target_arch = "aarch64"))]
65pub use self::aarch32::*;
66
67/// Reads a 32-bit system register
68#[inline(always)]
69pub unsafe fn __rsr<R>(reg: R) -> u32
70where
71 R: super::sealed::Rsr,
72{
73 reg.__rsr()
74}
75
76/// Reads a 64-bit system register
77#[cfg(target_arch = "aarch64")]
78#[inline(always)]
79pub unsafe fn __rsr64<R>(reg: R) -> u64
80where
81 R: super::sealed::Rsr64,
82{
83 reg.__rsr64()
84}
85
86/// Reads a system register containing an address
87#[inline(always)]
88pub unsafe fn __rsrp<R>(reg: R) -> *const u8
89where
90 R: super::sealed::Rsrp,
91{
92 reg.__rsrp()
93}
94
95/// Writes a 32-bit system register
96#[inline(always)]
97pub unsafe fn __wsr<R>(reg: R, value: u32)
98where
99 R: super::sealed::Wsr,
100{
101 reg.__wsr(value)
102}
103
104/// Writes a 64-bit system register
105#[cfg(target_arch = "aarch64")]
106#[inline(always)]
107pub unsafe fn __wsr64<R>(reg: R, value: u64)
108where
109 R: super::sealed::Wsr64,
110{
111 reg.__wsr64(value)
112}
113
114/// Writes a system register containing an address
115#[inline(always)]
116pub unsafe fn __wsrp<R>(reg: R, value: *const u8)
117where
118 R: super::sealed::Wsrp,
119{
120 reg.__wsrp(value)
121}