Skip to content

Commit 012f9aa

Browse files
committed
misc: replace asm! with naked_asm! in naked functions
Fixes: error[E0787]: the `asm!` macro is not allowed in naked functions Signed-off-by: Esteban Blanc <[email protected]>
1 parent d46f599 commit 012f9aa

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

hal_aarch64/src/irq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use core::arch::naked_asm;
12
use core::ptr;
23
use core::sync::atomic::{AtomicPtr, Ordering};
34

@@ -57,7 +58,7 @@ macro_rules! gen_isr_stub {
5758
#[no_mangle]
5859
#[repr(align(0x800))]
5960
unsafe extern "C" fn el1_vector_table() {
60-
core::arch::asm!(
61+
naked_asm!(
6162
gen_isr_stub!(),
6263
gen_isr_stub!(),
6364
gen_isr_stub!(),
@@ -70,7 +71,6 @@ unsafe extern "C" fn el1_vector_table() {
7071
gen_isr_stub!(),
7172
gen_isr_stub!(),
7273
gen_isr_stub!(),
73-
options(noreturn)
7474
);
7575
}
7676

hal_aarch64/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use cortex_a::registers::*;
66
use tock_registers::interfaces::Readable;
77

8-
use core::arch::asm;
8+
use core::arch::naked_asm;
99

1010
pub mod cpu;
1111
pub mod irq;
@@ -32,14 +32,13 @@ pub fn panic_info() -> PanicInfo {
3232
#[naked]
3333
#[no_mangle]
3434
unsafe extern "C" fn _start() -> ! {
35-
asm!(
35+
naked_asm!(
3636
"
3737
adrp x9, STACK_START
3838
msr spsel, xzr
3939
mov sp, x9
4040
b k_main
41-
",
42-
options(noreturn)
41+
"
4342
);
4443
}
4544

hal_riscv64/src/irq.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use log;
55
use super::plic::Plic;
66
use super::registers;
77

8-
use core::arch::asm;
8+
use core::arch::naked_asm;
99
use core::ptr;
1010
use core::sync::atomic::{AtomicPtr, Ordering};
1111

@@ -228,7 +228,7 @@ extern "C" fn c_trap_dispatch(cause: u64) -> u64 {
228228
#[no_mangle]
229229
#[repr(align(4))]
230230
unsafe extern "C" fn asm_trap_handler() {
231-
asm!(
231+
naked_asm!(
232232
"
233233
addi sp, sp, -0x100
234234
@@ -315,7 +315,6 @@ unsafe extern "C" fn asm_trap_handler() {
315315
addi sp, sp, 0x100
316316
317317
sret",
318-
options(noreturn)
319318
);
320319
// Obviously this isn't done, we need to jump back to the previous context before the
321320
// interrupt using mpp/spp and mepc/sepc.

hal_riscv64/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ pub mod mm;
77
mod plic;
88
mod registers;
99

10-
use core::arch::asm;
10+
use core::arch::naked_asm;
1111

1212
pub fn panic_info() {}
1313

1414
#[naked]
1515
#[no_mangle]
1616
unsafe extern "C" fn _start() -> ! {
17-
asm!("la sp, STACK_START", "call k_main", options(noreturn));
17+
naked_asm!("la sp, STACK_START", "call k_main");
1818
}
1919

2020
pub struct Riscv64CoreInfo;

0 commit comments

Comments
 (0)