From db8fb146146d71037fad91e3ecd664e2f5946375 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 4 Oct 2025 11:58:04 -0600 Subject: [PATCH] Fix compilation on other archs --- src/arch/aarch64/interrupt/handler.rs | 4 ++-- src/arch/aarch64/mod.rs | 2 +- src/arch/riscv64/interrupt/exception.rs | 2 +- src/arch/riscv64/interrupt/handler.rs | 2 +- src/arch/riscv64/mod.rs | 2 +- src/arch/x86/interrupt/handler.rs | 10 +++++----- src/arch/x86/mod.rs | 2 +- src/context/arch/aarch64.rs | 2 +- src/context/arch/riscv64.rs | 2 +- src/context/arch/x86.rs | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/arch/aarch64/interrupt/handler.rs b/src/arch/aarch64/interrupt/handler.rs index 2e4bc28733..763dd3f4fe 100644 --- a/src/arch/aarch64/interrupt/handler.rs +++ b/src/arch/aarch64/interrupt/handler.rs @@ -366,7 +366,7 @@ macro_rules! pop_special { #[macro_export] macro_rules! exception_stack { ($name:ident, |$stack:ident| $code:block) => { - #[naked] + #[unsafe(naked)] #[unsafe(no_mangle)] pub unsafe extern "C" fn $name(stack: &mut $crate::arch::aarch64::interrupt::InterruptStack) { unsafe { unsafe extern "C" fn inner($stack: &mut $crate::arch::aarch64::interrupt::InterruptStack) { unsafe { @@ -393,7 +393,7 @@ macro_rules! exception_stack { }} }; } -#[naked] +#[unsafe(naked)] pub unsafe extern "C" fn enter_usermode() -> ! { unsafe { core::arch::naked_asm!(concat!( diff --git a/src/arch/aarch64/mod.rs b/src/arch/aarch64/mod.rs index 94ab7981c9..a37dd25cc7 100644 --- a/src/arch/aarch64/mod.rs +++ b/src/arch/aarch64/mod.rs @@ -36,7 +36,7 @@ pub use ::rmm::AArch64Arch as CurrentRmmArch; pub use arch_copy_to_user as arch_copy_from_user; -#[naked] +#[unsafe(naked)] #[unsafe(link_section = ".usercopy-fns")] pub unsafe extern "C" fn arch_copy_to_user(dst: usize, src: usize, len: usize) -> u8 { unsafe { diff --git a/src/arch/riscv64/interrupt/exception.rs b/src/arch/riscv64/interrupt/exception.rs index c87b158105..e321d03124 100644 --- a/src/arch/riscv64/interrupt/exception.rs +++ b/src/arch/riscv64/interrupt/exception.rs @@ -20,7 +20,7 @@ const STORE_PAGE_FAULT: usize = 15; use super::InterruptStack; -#[naked] +#[unsafe(naked)] // FIXME use extern "custom" // FIXME use align(4) pub unsafe extern "C" fn exception_handler() { diff --git a/src/arch/riscv64/interrupt/handler.rs b/src/arch/riscv64/interrupt/handler.rs index 4d3b25f70e..c73510aad3 100644 --- a/src/arch/riscv64/interrupt/handler.rs +++ b/src/arch/riscv64/interrupt/handler.rs @@ -300,7 +300,7 @@ macro_rules! pop_registers { }; } -#[naked] +#[unsafe(naked)] pub unsafe extern "C" fn enter_usermode() -> ! { unsafe { core::arch::naked_asm!(concat!( diff --git a/src/arch/riscv64/mod.rs b/src/arch/riscv64/mod.rs index bf1f2ef527..41b78ba5cd 100644 --- a/src/arch/riscv64/mod.rs +++ b/src/arch/riscv64/mod.rs @@ -16,7 +16,7 @@ use core::arch::naked_asm; pub use arch_copy_to_user as arch_copy_from_user; #[unsafe(link_section = ".usercopy-fns")] -#[naked] +#[unsafe(naked)] pub unsafe extern "C" fn arch_copy_to_user(dst: usize, src: usize, len: usize) -> u8 { unsafe { naked_asm!( diff --git a/src/arch/x86/interrupt/handler.rs b/src/arch/x86/interrupt/handler.rs index 3f2faff586..ea057b301c 100644 --- a/src/arch/x86/interrupt/handler.rs +++ b/src/arch/x86/interrupt/handler.rs @@ -266,7 +266,7 @@ macro_rules! interrupt_stack { // XXX: Apparently we cannot use $expr and check for bool exhaustiveness, so we will have to // use idents directly instead. ($name:ident, |$stack:ident| $code:block) => { - #[naked] + #[unsafe(naked)] pub unsafe extern "C" fn $name() { unsafe { unsafe extern "fastcall" fn inner($stack: &mut $crate::arch::x86::interrupt::InterruptStack) { // TODO: Force the declarations to specify unsafe? @@ -317,7 +317,7 @@ macro_rules! interrupt_stack { #[macro_export] macro_rules! interrupt { ($name:ident, || $code:block) => { - #[naked] + #[unsafe(naked)] pub unsafe extern "C" fn $name() { unsafe { unsafe extern "C" fn inner() { $code @@ -357,7 +357,7 @@ macro_rules! interrupt { #[macro_export] macro_rules! interrupt_error { ($name:ident, |$stack:ident, $error_code:ident| $code:block) => { - #[naked] + #[unsafe(naked)] pub unsafe extern "C" fn $name() { unsafe { unsafe extern "C" fn inner($stack: &mut $crate::arch::x86::interrupt::handler::InterruptErrorStack) { let $error_code: usize = $stack.code; @@ -409,7 +409,7 @@ macro_rules! interrupt_error { }} }; } -#[naked] +#[unsafe(naked)] unsafe extern "C" fn usercopy_trampoline() { unsafe { core::arch::naked_asm!( @@ -441,7 +441,7 @@ impl ArchIntCtx for InterruptStack { } } -#[naked] +#[unsafe(naked)] pub unsafe extern "C" fn enter_usermode() { unsafe { core::arch::naked_asm!(concat!( diff --git a/src/arch/x86/mod.rs b/src/arch/x86/mod.rs index 2461c02dd4..80e2d6fbf3 100644 --- a/src/arch/x86/mod.rs +++ b/src/arch/x86/mod.rs @@ -16,7 +16,7 @@ pub mod flags { pub const FLAG_SINGLESTEP: usize = 1 << SHIFT_SINGLESTEP; } -#[naked] +#[unsafe(naked)] #[unsafe(link_section = ".usercopy-fns")] pub unsafe extern "C" fn arch_copy_to_user(dst: usize, src: usize, len: usize) -> u8 { unsafe { diff --git a/src/context/arch/aarch64.rs b/src/context/arch/aarch64.rs index 4602c36635..bf0047b26f 100644 --- a/src/context/arch/aarch64.rs +++ b/src/context/arch/aarch64.rs @@ -290,7 +290,7 @@ pub unsafe fn switch_to(prev: &mut super::Context, next: &mut super::Context) { } } -#[naked] +#[unsafe(naked)] unsafe extern "C" fn switch_to_inner(_prev: &mut Context, _next: &mut Context) { unsafe { core::arch::naked_asm!( diff --git a/src/context/arch/riscv64.rs b/src/context/arch/riscv64.rs index a7bee5f1c9..3e31b1e96b 100644 --- a/src/context/arch/riscv64.rs +++ b/src/context/arch/riscv64.rs @@ -152,7 +152,7 @@ pub unsafe fn switch_to(prev: &mut super::Context, next: &mut super::Context) { } } -#[naked] +#[unsafe(naked)] unsafe extern "C" fn switch_to_inner(prev: &mut Context, next: &mut Context) { unsafe { core::arch::naked_asm!(r#" diff --git a/src/context/arch/x86.rs b/src/context/arch/x86.rs index 2538c8bb39..b43bb557f0 100644 --- a/src/context/arch/x86.rs +++ b/src/context/arch/x86.rs @@ -254,7 +254,7 @@ pub unsafe fn switch_to(prev: &mut super::Context, next: &mut super::Context) { } // Check disassembly! -#[naked] +#[unsafe(naked)] unsafe extern "cdecl" fn switch_to_inner() { unsafe { use Context as Cx;