Skip to content

Commit 30e23db

Browse files
japaricgnzlbg
authored andcommitted
add #[assert_instr(...)]
1 parent 7a8de0d commit 30e23db

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

coresimd/arm/cmsis.rs

+27
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/// executed in Privileged modes.
1313
#[inline]
1414
#[target_feature(enable = "mclass")]
15+
#[cfg_attr(test, assert_instr(cpsie))]
1516
pub unsafe fn __enable_irq() {
1617
asm!("cpsie i" : : : "memory" : "volatile");
1718
}
@@ -22,6 +23,7 @@ pub unsafe fn __enable_irq() {
2223
/// executed in Privileged modes.
2324
#[inline]
2425
#[target_feature(enable = "mclass")]
26+
#[cfg_attr(test, assert_instr(cpsid))]
2527
pub unsafe fn __disable_irq() {
2628
asm!("cpsid i" : : : "memory" : "volatile");
2729
}
@@ -31,6 +33,7 @@ pub unsafe fn __disable_irq() {
3133
/// Returns the content of the Control Register.
3234
#[inline]
3335
#[target_feature(enable = "mclass")]
36+
#[cfg_attr(test, assert_instr(mrs))]
3437
pub unsafe fn __get_CONTROL() -> u32 {
3538
let result: u32;
3639
asm!("mrs $0, CONTROL" : "=r"(result) : : : "volatile");
@@ -42,6 +45,7 @@ pub unsafe fn __get_CONTROL() -> u32 {
4245
/// Writes the given value to the Control Register.
4346
#[inline]
4447
#[target_feature(enable = "mclass")]
48+
#[cfg_attr(test, assert_instr(msr))]
4549
pub unsafe fn __set_CONTROL(control: u32) {
4650
asm!("msr CONTROL, $0" : : "r"(control) : "memory" : "volatile");
4751
}
@@ -51,6 +55,7 @@ pub unsafe fn __set_CONTROL(control: u32) {
5155
/// Returns the content of the IPSR Register.
5256
#[inline]
5357
#[target_feature(enable = "mclass")]
58+
#[cfg_attr(test, assert_instr(mrs))]
5459
pub unsafe fn __get_IPSR() -> u32 {
5560
let result: u32;
5661
asm!("mrs $0, IPSR" : "=r"(result) : : : "volatile");
@@ -62,6 +67,7 @@ pub unsafe fn __get_IPSR() -> u32 {
6267
/// Returns the content of the APSR Register.
6368
#[inline]
6469
#[target_feature(enable = "mclass")]
70+
#[cfg_attr(test, assert_instr(mrs))]
6571
pub unsafe fn __get_APSR() -> u32 {
6672
let result: u32;
6773
asm!("mrs $0, APSR" : "=r"(result) : : : "volatile");
@@ -73,6 +79,7 @@ pub unsafe fn __get_APSR() -> u32 {
7379
/// Returns the content of the xPSR Register.
7480
#[inline]
7581
#[target_feature(enable = "mclass")]
82+
#[cfg_attr(test, assert_instr(mrs))]
7683
pub unsafe fn __get_xPSR() -> u32 {
7784
let result: u32;
7885
asm!("mrs $0, XPSR" : "=r"(result) : : : "volatile");
@@ -84,6 +91,7 @@ pub unsafe fn __get_xPSR() -> u32 {
8491
/// Returns the current value of the Process Stack Pointer (PSP).
8592
#[inline]
8693
#[target_feature(enable = "mclass")]
94+
#[cfg_attr(test, assert_instr(mrs))]
8795
pub unsafe fn __get_PSP() -> u32 {
8896
let result: u32;
8997
asm!("mrs $0, PSP" : "=r"(result) : : : "volatile");
@@ -95,6 +103,7 @@ pub unsafe fn __get_PSP() -> u32 {
95103
/// Assigns the given value to the Process Stack Pointer (PSP).
96104
#[inline]
97105
#[target_feature(enable = "mclass")]
106+
#[cfg_attr(test, assert_instr(msr))]
98107
pub unsafe fn __set_PSP(top_of_proc_stack: u32) {
99108
asm!("msr PSP, $0" : : "r"(top_of_proc_stack) : : "volatile");
100109
}
@@ -104,6 +113,7 @@ pub unsafe fn __set_PSP(top_of_proc_stack: u32) {
104113
/// Returns the current value of the Main Stack Pointer (MSP).
105114
#[inline]
106115
#[target_feature(enable = "mclass")]
116+
#[cfg_attr(test, assert_instr(mrs))]
107117
pub unsafe fn __get_MSP() -> u32 {
108118
let result: u32;
109119
asm!("mrs $0, MSP" : "=r"(result) : : : "volatile");
@@ -115,6 +125,7 @@ pub unsafe fn __get_MSP() -> u32 {
115125
/// Assigns the given value to the Main Stack Pointer (MSP).
116126
#[inline]
117127
#[target_feature(enable = "mclass")]
128+
#[cfg_attr(test, assert_instr(msr))]
118129
pub unsafe fn __set_MSP(top_of_main_stack: u32) {
119130
asm!("msr MSP, $0" : : "r"(top_of_main_stack) : : "volatile");
120131
}
@@ -125,6 +136,7 @@ pub unsafe fn __set_MSP(top_of_main_stack: u32) {
125136
/// Register.
126137
#[inline]
127138
#[target_feature(enable = "mclass")]
139+
#[cfg_attr(test, assert_instr(mrs))]
128140
pub unsafe fn __get_PRIMASK() -> u32 {
129141
let result: u32;
130142
asm!("mrs $0, PRIMASK" : "=r"(result) : : "memory" : "volatile");
@@ -136,6 +148,7 @@ pub unsafe fn __get_PRIMASK() -> u32 {
136148
/// Assigns the given value to the Priority Mask Register.
137149
#[inline]
138150
#[target_feature(enable = "mclass")]
151+
#[cfg_attr(test, assert_instr(msr))]
139152
pub unsafe fn __set_PRIMASK(pri_mask: u32) {
140153
asm!("msr PRIMASK, $0" : : "r"(pri_mask) : : "volatile");
141154
}
@@ -148,6 +161,7 @@ mod v7 {
148161
/// executed in Privileged modes.
149162
#[inline]
150163
#[target_feature(enable = "mclass")]
164+
#[cfg_attr(test, assert_instr(cpsie))]
151165
pub unsafe fn __enable_fault_irq() {
152166
asm!("cpsie f" : : : "memory" : "volatile");
153167
}
@@ -158,6 +172,7 @@ mod v7 {
158172
/// executed in Privileged modes.
159173
#[inline]
160174
#[target_feature(enable = "mclass")]
175+
#[cfg_attr(test, assert_instr(cpsid))]
161176
pub unsafe fn __disable_fault_irq() {
162177
asm!("cpsid f" : : : "memory" : "volatile");
163178
}
@@ -167,6 +182,7 @@ mod v7 {
167182
/// Returns the current value of the Base Priority register.
168183
#[inline]
169184
#[target_feature(enable = "mclass")]
185+
#[cfg_attr(test, assert_instr(mrs))]
170186
pub unsafe fn __get_BASEPRI() -> u32 {
171187
let result: u32;
172188
asm!("mrs $0, BASEPRI" : "=r"(result) : : : "volatile");
@@ -178,6 +194,7 @@ mod v7 {
178194
/// Assigns the given value to the Base Priority register.
179195
#[inline]
180196
#[target_feature(enable = "mclass")]
197+
#[cfg_attr(test, assert_instr(msr))]
181198
pub unsafe fn __set_BASEPRI(base_pri: u32) {
182199
asm!("msr BASEPRI, $0" : : "r"(base_pri) : "memory" : "volatile");
183200
}
@@ -189,6 +206,7 @@ mod v7 {
189206
/// priority level.
190207
#[inline]
191208
#[target_feature(enable = "mclass")]
209+
#[cfg_attr(test, assert_instr(mrs))]
192210
pub unsafe fn __set_BASEPRI_MAX(base_pri: u32) {
193211
asm!("msr BASEPRI_MAX, $0" : : "r"(base_pri) : "memory" : "volatile");
194212
}
@@ -198,6 +216,7 @@ mod v7 {
198216
/// Returns the current value of the Fault Mask register.
199217
#[inline]
200218
#[target_feature(enable = "mclass")]
219+
#[cfg_attr(test, assert_instr(mrs))]
201220
pub unsafe fn __get_FAULTMASK() -> u32 {
202221
let result: u32;
203222
asm!("mrs $0, FAULTMASK" : "=r"(result) : : : "volatile");
@@ -209,6 +228,7 @@ mod v7 {
209228
/// Assigns the given value to the Fault Mask register.
210229
#[inline]
211230
#[target_feature(enable = "mclass")]
231+
#[cfg_attr(test, assert_instr(msr))]
212232
pub unsafe fn __set_FAULTMASK(fault_mask: u32) {
213233
asm!("msr FAULTMASK, $0" : : "r"(fault_mask) : "memory" : "volatile");
214234
}
@@ -225,6 +245,7 @@ pub use self::v7::*;
225245
/// purposes.
226246
#[inline]
227247
#[target_feature(enable = "mclass")]
248+
#[cfg_attr(test, assert_instr(nop))]
228249
pub unsafe fn __NOP() {
229250
asm!("nop" : : : : "volatile");
230251
}
@@ -235,6 +256,7 @@ pub unsafe fn __NOP() {
235256
/// of a number of events occurs.
236257
#[inline]
237258
#[target_feature(enable = "mclass")]
259+
#[cfg_attr(test, assert_instr(wfi))]
238260
pub unsafe fn __WFI() {
239261
asm!("wfi" : : : : "volatile");
240262
}
@@ -245,6 +267,7 @@ pub unsafe fn __WFI() {
245267
/// low-power state until one of a number of events occurs.
246268
#[inline]
247269
#[target_feature(enable = "mclass")]
270+
#[cfg_attr(test, assert_instr(wfe))]
248271
pub unsafe fn __WFE() {
249272
asm!("wfe" : : : : "volatile");
250273
}
@@ -255,6 +278,7 @@ pub unsafe fn __WFE() {
255278
/// CPU.
256279
#[inline]
257280
#[target_feature(enable = "mclass")]
281+
#[cfg_attr(test, assert_instr(sev))]
258282
pub unsafe fn __SEV() {
259283
asm!("sev" : : : : "volatile");
260284
}
@@ -266,6 +290,7 @@ pub unsafe fn __SEV() {
266290
/// memory, after the instruction has been completed.
267291
#[inline]
268292
#[target_feature(enable = "mclass")]
293+
#[cfg_attr(test, assert_instr(isb))]
269294
pub unsafe fn __ISB() {
270295
asm!("isb 0xF" : : : "memory" : "volatile");
271296
}
@@ -276,6 +301,7 @@ pub unsafe fn __ISB() {
276301
/// explicit memory accesses before this instruction complete.
277302
#[inline]
278303
#[target_feature(enable = "mclass")]
304+
#[cfg_attr(test, assert_instr(dsb))]
279305
pub unsafe fn __DSB() {
280306
asm!("dsb 0xF" : : : "memory" : "volatile");
281307
}
@@ -286,6 +312,7 @@ pub unsafe fn __DSB() {
286312
/// after the instruction, without ensuring their completion.
287313
#[inline]
288314
#[target_feature(enable = "mclass")]
315+
#[cfg_attr(test, assert_instr(dmb))]
289316
pub unsafe fn __DMB() {
290317
asm!("dmb 0xF" : : : "memory" : "volatile");
291318
}

0 commit comments

Comments
 (0)