Skip to content

Commit 7a8de0d

Browse files
japaricgnzlbg
authored andcommitted
add #[target_feature(enable = ...)]
1 parent afcc777 commit 7a8de0d

File tree

1 file changed

+54
-27
lines changed

1 file changed

+54
-27
lines changed

coresimd/arm/cmsis.rs

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
///
1111
/// Enables IRQ interrupts by clearing the I-bit in the CPSR. Can only be
1212
/// executed in Privileged modes.
13-
#[inline(always)]
13+
#[inline]
14+
#[target_feature(enable = "mclass")]
1415
pub unsafe fn __enable_irq() {
1516
asm!("cpsie i" : : : "memory" : "volatile");
1617
}
@@ -19,15 +20,17 @@ pub unsafe fn __enable_irq() {
1920
///
2021
/// Disables IRQ interrupts by setting the I-bit in the CPSR. Can only be
2122
/// executed in Privileged modes.
22-
#[inline(always)]
23+
#[inline]
24+
#[target_feature(enable = "mclass")]
2325
pub unsafe fn __disable_irq() {
2426
asm!("cpsid i" : : : "memory" : "volatile");
2527
}
2628

2729
/// Get Control Register
2830
///
2931
/// Returns the content of the Control Register.
30-
#[inline(always)]
32+
#[inline]
33+
#[target_feature(enable = "mclass")]
3134
pub unsafe fn __get_CONTROL() -> u32 {
3235
let result: u32;
3336
asm!("mrs $0, CONTROL" : "=r"(result) : : : "volatile");
@@ -37,15 +40,17 @@ pub unsafe fn __get_CONTROL() -> u32 {
3740
/// Set Control Register
3841
///
3942
/// Writes the given value to the Control Register.
40-
#[inline(always)]
43+
#[inline]
44+
#[target_feature(enable = "mclass")]
4145
pub unsafe fn __set_CONTROL(control: u32) {
4246
asm!("msr CONTROL, $0" : : "r"(control) : "memory" : "volatile");
4347
}
4448

4549
/// Get IPSR Register
4650
///
4751
/// Returns the content of the IPSR Register.
48-
#[inline(always)]
52+
#[inline]
53+
#[target_feature(enable = "mclass")]
4954
pub unsafe fn __get_IPSR() -> u32 {
5055
let result: u32;
5156
asm!("mrs $0, IPSR" : "=r"(result) : : : "volatile");
@@ -55,7 +60,8 @@ pub unsafe fn __get_IPSR() -> u32 {
5560
/// Get APSR Register
5661
///
5762
/// Returns the content of the APSR Register.
58-
#[inline(always)]
63+
#[inline]
64+
#[target_feature(enable = "mclass")]
5965
pub unsafe fn __get_APSR() -> u32 {
6066
let result: u32;
6167
asm!("mrs $0, APSR" : "=r"(result) : : : "volatile");
@@ -65,7 +71,8 @@ pub unsafe fn __get_APSR() -> u32 {
6571
/// Get xPSR Register
6672
///
6773
/// Returns the content of the xPSR Register.
68-
#[inline(always)]
74+
#[inline]
75+
#[target_feature(enable = "mclass")]
6976
pub unsafe fn __get_xPSR() -> u32 {
7077
let result: u32;
7178
asm!("mrs $0, XPSR" : "=r"(result) : : : "volatile");
@@ -75,7 +82,8 @@ pub unsafe fn __get_xPSR() -> u32 {
7582
/// Get Process Stack Pointer
7683
///
7784
/// Returns the current value of the Process Stack Pointer (PSP).
78-
#[inline(always)]
85+
#[inline]
86+
#[target_feature(enable = "mclass")]
7987
pub unsafe fn __get_PSP() -> u32 {
8088
let result: u32;
8189
asm!("mrs $0, PSP" : "=r"(result) : : : "volatile");
@@ -85,15 +93,17 @@ pub unsafe fn __get_PSP() -> u32 {
8593
/// Set Process Stack Pointer
8694
///
8795
/// Assigns the given value to the Process Stack Pointer (PSP).
88-
#[inline(always)]
96+
#[inline]
97+
#[target_feature(enable = "mclass")]
8998
pub unsafe fn __set_PSP(top_of_proc_stack: u32) {
9099
asm!("msr PSP, $0" : : "r"(top_of_proc_stack) : : "volatile");
91100
}
92101

93102
/// Get Main Stack Pointer
94103
///
95104
/// Returns the current value of the Main Stack Pointer (MSP).
96-
#[inline(always)]
105+
#[inline]
106+
#[target_feature(enable = "mclass")]
97107
pub unsafe fn __get_MSP() -> u32 {
98108
let result: u32;
99109
asm!("mrs $0, MSP" : "=r"(result) : : : "volatile");
@@ -103,7 +113,8 @@ pub unsafe fn __get_MSP() -> u32 {
103113
/// Set Main Stack Pointer
104114
///
105115
/// Assigns the given value to the Main Stack Pointer (MSP).
106-
#[inline(always)]
116+
#[inline]
117+
#[target_feature(enable = "mclass")]
107118
pub unsafe fn __set_MSP(top_of_main_stack: u32) {
108119
asm!("msr MSP, $0" : : "r"(top_of_main_stack) : : "volatile");
109120
}
@@ -112,7 +123,8 @@ pub unsafe fn __set_MSP(top_of_main_stack: u32) {
112123
///
113124
/// Returns the current state of the priority mask bit from the Priority Mask
114125
/// Register.
115-
#[inline(always)]
126+
#[inline]
127+
#[target_feature(enable = "mclass")]
116128
pub unsafe fn __get_PRIMASK() -> u32 {
117129
let result: u32;
118130
asm!("mrs $0, PRIMASK" : "=r"(result) : : "memory" : "volatile");
@@ -122,7 +134,8 @@ pub unsafe fn __get_PRIMASK() -> u32 {
122134
/// Set Priority Mask
123135
///
124136
/// Assigns the given value to the Priority Mask Register.
125-
#[inline(always)]
137+
#[inline]
138+
#[target_feature(enable = "mclass")]
126139
pub unsafe fn __set_PRIMASK(pri_mask: u32) {
127140
asm!("msr PRIMASK, $0" : : "r"(pri_mask) : : "volatile");
128141
}
@@ -133,7 +146,8 @@ mod v7 {
133146
///
134147
/// Enables FIQ interrupts by clearing the F-bit in the CPSR. Can only be
135148
/// executed in Privileged modes.
136-
#[inline(always)]
149+
#[inline]
150+
#[target_feature(enable = "mclass")]
137151
pub unsafe fn __enable_fault_irq() {
138152
asm!("cpsie f" : : : "memory" : "volatile");
139153
}
@@ -142,15 +156,17 @@ mod v7 {
142156
///
143157
/// Disables FIQ interrupts by setting the F-bit in the CPSR. Can only be
144158
/// executed in Privileged modes.
145-
#[inline(always)]
159+
#[inline]
160+
#[target_feature(enable = "mclass")]
146161
pub unsafe fn __disable_fault_irq() {
147162
asm!("cpsid f" : : : "memory" : "volatile");
148163
}
149164

150165
/// Get Base Priority
151166
///
152167
/// Returns the current value of the Base Priority register.
153-
#[inline(always)]
168+
#[inline]
169+
#[target_feature(enable = "mclass")]
154170
pub unsafe fn __get_BASEPRI() -> u32 {
155171
let result: u32;
156172
asm!("mrs $0, BASEPRI" : "=r"(result) : : : "volatile");
@@ -160,7 +176,8 @@ mod v7 {
160176
/// Set Base Priority
161177
///
162178
/// Assigns the given value to the Base Priority register.
163-
#[inline(always)]
179+
#[inline]
180+
#[target_feature(enable = "mclass")]
164181
pub unsafe fn __set_BASEPRI(base_pri: u32) {
165182
asm!("msr BASEPRI, $0" : : "r"(base_pri) : "memory" : "volatile");
166183
}
@@ -170,15 +187,17 @@ mod v7 {
170187
/// Assigns the given value to the Base Priority register only if BASEPRI
171188
/// masking is disabled, or the new value increases the BASEPRI
172189
/// priority level.
173-
#[inline(always)]
190+
#[inline]
191+
#[target_feature(enable = "mclass")]
174192
pub unsafe fn __set_BASEPRI_MAX(base_pri: u32) {
175193
asm!("msr BASEPRI_MAX, $0" : : "r"(base_pri) : "memory" : "volatile");
176194
}
177195

178196
/// Get Fault Mask
179197
///
180198
/// Returns the current value of the Fault Mask register.
181-
#[inline(always)]
199+
#[inline]
200+
#[target_feature(enable = "mclass")]
182201
pub unsafe fn __get_FAULTMASK() -> u32 {
183202
let result: u32;
184203
asm!("mrs $0, FAULTMASK" : "=r"(result) : : : "volatile");
@@ -188,7 +207,8 @@ mod v7 {
188207
/// Set Fault Mask
189208
///
190209
/// Assigns the given value to the Fault Mask register.
191-
#[inline(always)]
210+
#[inline]
211+
#[target_feature(enable = "mclass")]
192212
pub unsafe fn __set_FAULTMASK(fault_mask: u32) {
193213
asm!("msr FAULTMASK, $0" : : "r"(fault_mask) : "memory" : "volatile");
194214
}
@@ -203,7 +223,8 @@ pub use self::v7::*;
203223
///
204224
/// No Operation does nothing. This instruction can be used for code alignment
205225
/// purposes.
206-
#[inline(always)]
226+
#[inline]
227+
#[target_feature(enable = "mclass")]
207228
pub unsafe fn __NOP() {
208229
asm!("nop" : : : : "volatile");
209230
}
@@ -212,7 +233,8 @@ pub unsafe fn __NOP() {
212233
///
213234
/// Wait For Interrupt is a hint instruction that suspends execution until one
214235
/// of a number of events occurs.
215-
#[inline(always)]
236+
#[inline]
237+
#[target_feature(enable = "mclass")]
216238
pub unsafe fn __WFI() {
217239
asm!("wfi" : : : : "volatile");
218240
}
@@ -221,7 +243,8 @@ pub unsafe fn __WFI() {
221243
///
222244
/// Wait For Event is a hint instruction that permits the processor to enter a
223245
/// low-power state until one of a number of events occurs.
224-
#[inline(always)]
246+
#[inline]
247+
#[target_feature(enable = "mclass")]
225248
pub unsafe fn __WFE() {
226249
asm!("wfe" : : : : "volatile");
227250
}
@@ -230,7 +253,8 @@ pub unsafe fn __WFE() {
230253
///
231254
/// Send Event is a hint instruction. It causes an event to be signaled to the
232255
/// CPU.
233-
#[inline(always)]
256+
#[inline]
257+
#[target_feature(enable = "mclass")]
234258
pub unsafe fn __SEV() {
235259
asm!("sev" : : : : "volatile");
236260
}
@@ -240,7 +264,8 @@ pub unsafe fn __SEV() {
240264
/// Instruction Synchronization Barrier flushes the pipeline in the processor,
241265
/// so that all instructions following the ISB are fetched from cache or
242266
/// memory, after the instruction has been completed.
243-
#[inline(always)]
267+
#[inline]
268+
#[target_feature(enable = "mclass")]
244269
pub unsafe fn __ISB() {
245270
asm!("isb 0xF" : : : "memory" : "volatile");
246271
}
@@ -249,7 +274,8 @@ pub unsafe fn __ISB() {
249274
///
250275
/// Acts as a special kind of Data Memory Barrier. It completes when all
251276
/// explicit memory accesses before this instruction complete.
252-
#[inline(always)]
277+
#[inline]
278+
#[target_feature(enable = "mclass")]
253279
pub unsafe fn __DSB() {
254280
asm!("dsb 0xF" : : : "memory" : "volatile");
255281
}
@@ -258,7 +284,8 @@ pub unsafe fn __DSB() {
258284
///
259285
/// Ensures the apparent order of the explicit memory operations before and
260286
/// after the instruction, without ensuring their completion.
261-
#[inline(always)]
287+
#[inline]
288+
#[target_feature(enable = "mclass")]
262289
pub unsafe fn __DMB() {
263290
asm!("dmb 0xF" : : : "memory" : "volatile");
264291
}

0 commit comments

Comments
 (0)