2
2
3
3
#![ crate_name = "cortexm" ]
4
4
#![ crate_type = "rlib" ]
5
- #![ feature( asm , asm_sym) ]
5
+ #![ feature( asm_sym) ]
6
6
#![ feature( naked_functions) ]
7
7
#![ no_std]
8
8
@@ -40,6 +40,7 @@ extern "C" {
40
40
) ) ]
41
41
#[ naked]
42
42
pub unsafe extern "C" fn systick_handler_arm_v7m ( ) {
43
+ use core:: arch:: asm;
43
44
asm ! (
44
45
"
45
46
// Set thread mode to privileged to switch back to kernel mode.
@@ -70,6 +71,7 @@ pub unsafe extern "C" fn systick_handler_arm_v7m() {
70
71
) ) ]
71
72
#[ naked]
72
73
pub unsafe extern "C" fn svc_handler_arm_v7m ( ) {
74
+ use core:: arch:: asm;
73
75
asm ! (
74
76
"
75
77
// First check to see which direction we are going in. If the link register
@@ -132,6 +134,7 @@ pub unsafe extern "C" fn svc_handler_arm_v7m() {
132
134
) ) ]
133
135
#[ naked]
134
136
pub unsafe extern "C" fn generic_isr_arm_v7m ( ) {
137
+ use core:: arch:: asm;
135
138
asm ! (
136
139
"
137
140
// Set thread mode to privileged to ensure we are executing as the kernel.
@@ -209,6 +212,7 @@ pub unsafe extern "C" fn generic_isr_arm_v7m() {
209
212
210
213
#[ cfg( all( target_arch = "arm" , target_os = "none" ) ) ]
211
214
pub unsafe extern "C" fn unhandled_interrupt ( ) {
215
+ use core:: arch:: asm;
212
216
let mut interrupt_number: u32 ;
213
217
214
218
// IPSR[8:0] holds the currently active interrupt
@@ -232,6 +236,7 @@ pub unsafe extern "C" fn unhandled_interrupt() {
232
236
#[ cfg( all( target_arch = "arm" , target_os = "none" ) ) ]
233
237
#[ naked]
234
238
pub unsafe extern "C" fn initialize_ram_jump_to_main ( ) {
239
+ use core:: arch:: asm;
235
240
asm ! (
236
241
"
237
242
// Start by initializing .bss memory. The Tock linker script defines
@@ -298,6 +303,7 @@ pub unsafe extern "C" fn switch_to_user_arm_v7m(
298
303
mut user_stack : * const usize ,
299
304
process_regs : & mut [ usize ; 8 ] ,
300
305
) -> * const usize {
306
+ use core:: arch:: asm;
301
307
asm ! (
302
308
"
303
309
// Rust `asm!()` macro (as of May 2021) will not let us mark r6, r7 and r9
@@ -514,6 +520,7 @@ unsafe extern "C" fn hard_fault_handler_arm_v7m_continued(
514
520
kernel_stack : u32 ,
515
521
stack_overflow : u32 ,
516
522
) {
523
+ use core:: arch:: asm;
517
524
if kernel_stack != 0 {
518
525
if stack_overflow != 0 {
519
526
// Panic to show the correct error.
@@ -570,6 +577,7 @@ unsafe extern "C" fn hard_fault_handler_arm_v7m_continued(
570
577
) ) ]
571
578
#[ naked]
572
579
pub unsafe extern "C" fn hard_fault_handler_arm_v7m ( ) {
580
+ use core:: arch:: asm;
573
581
// First need to determine if this a kernel fault or a userspace fault, and store
574
582
// the unmodified stack pointer. Place these values in registers, then call
575
583
// a non-naked function, to allow for use of rust code alongside inline asm.
0 commit comments