diff --git a/src/interrupts.rs b/src/interrupts.rs index c2cd42c..6bafdf0 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -9,7 +9,7 @@ use crate::{ use alloc::{boxed::Box, vec::Vec}; use az::WrappingCast; use cast::{u64, usize}; -use core::{arch::asm, ffi::CStr, fmt::Write, ptr, slice}; +use core::{arch::{asm, naked_asm}, ffi::CStr, fmt::Write, ptr, slice}; use hashbrown::HashMap; use pic8259::ChainedPics; use saturating_cast::SaturatingCast; @@ -282,7 +282,7 @@ static mut SYSCALL_REGS: SyscallRegs = SyscallRegs { #[naked] extern "x86-interrupt" fn syscall_handler_header(stack_frame: InterruptStackFrame) { unsafe { - asm!( + naked_asm!( "mov [rip+SYSCALL_REGS], rax", "mov [rip+SYSCALL_REGS+8], rbx", "mov [rip+SYSCALL_REGS+16], rcx", @@ -300,7 +300,6 @@ extern "x86-interrupt" fn syscall_handler_header(stack_frame: InterruptStackFram "mov [rip+SYSCALL_REGS+112], r14", "mov [rip+SYSCALL_REGS+120], r15", "jmp syscall_handler", - options(noreturn) ) } } diff --git a/src/tasking.rs b/src/tasking.rs index 5826b0d..7762b28 100644 --- a/src/tasking.rs +++ b/src/tasking.rs @@ -6,7 +6,7 @@ use alloc::{ }; use core::{ alloc::Layout, - arch::asm, + arch::naked_asm, ffi::CStr, ptr::{addr_of, addr_of_mut}, sync::atomic::{AtomicBool, Ordering}, @@ -24,7 +24,7 @@ use cast::{u64, usize}; #[naked] extern "C" fn switch_to_asm(current_stack: *mut *mut usize, next_stack: *mut usize) { unsafe { - asm!( + naked_asm!( "push rbp", "push rbx", "push r12", @@ -40,7 +40,6 @@ extern "C" fn switch_to_asm(current_stack: *mut *mut usize, next_stack: *mut usi "pop rbx", "pop rbp", "ret", - options(noreturn) ); } } @@ -48,7 +47,7 @@ extern "C" fn switch_to_asm(current_stack: *mut *mut usize, next_stack: *mut usi #[naked] extern "C" fn switch_to_asm_exit(next_stack: *mut usize) { unsafe { - asm!( + naked_asm!( "mov rsp, rdi", "pop r15", "pop r14", @@ -57,7 +56,6 @@ extern "C" fn switch_to_asm_exit(next_stack: *mut usize) { "pop rbx", "pop rbp", "ret", - options(noreturn) ); } } @@ -65,7 +63,7 @@ extern "C" fn switch_to_asm_exit(next_stack: *mut usize) { #[naked] extern "C" fn task_init() { unsafe { - asm!( + naked_asm!( "pop rcx", // Get the user stack pointer "pop rbx", // Get the entry point "push 43", // Push the stack segment selector - same as data @@ -77,7 +75,6 @@ extern "C" fn task_init() { "push 51", // Push the code selector "push rbx", // Push the entry point "iretq", // Return from the fake interrupt and enter user mode - options(noreturn) ) } }