From fe0720d53ee17ccfceccd182b4005d8446e8a47f Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Sat, 25 Jul 2020 09:44:54 -0400 Subject: [PATCH] Always inline disabling interrupts It never makes sense to call a function for these two instructions. Additionally, I use this at system boot time to configure the stack pointer itself. If this becomes a function call, then _everything_ is broken! --- src/interrupt.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/interrupt.rs b/src/interrupt.rs index 34a2697..8c438b5 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -11,6 +11,7 @@ struct DisableInterrupts(PhantomData<()>); /// /// Restores interrupts after the closure has completed /// execution. +#[inline(always)] pub fn without_interrupts(f: F) -> T where F: FnOnce() -> T { @@ -19,7 +20,7 @@ pub fn without_interrupts(f: F) -> T } impl DisableInterrupts { - #[inline] + #[inline(always)] pub fn new() -> DisableInterrupts { unsafe { llvm_asm!("CLI") } DisableInterrupts(PhantomData) @@ -27,7 +28,7 @@ impl DisableInterrupts { } impl Drop for DisableInterrupts { - #[inline] + #[inline(always)] fn drop(&mut self) { unsafe { llvm_asm!("SEI") } }