From a396a68a43e684b4388cfdcaa0caacbe0dcc4b71 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jun 2017 11:31:51 -0500 Subject: turn interrupt::{enable,disable} into compiler barriers --- src/interrupt.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/interrupt.rs b/src/interrupt.rs index 95b5989..2e43e85 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -45,7 +45,7 @@ pub fn disable() { asm!("cpsid i" : : - : + : "memory" : "volatile"); }, #[cfg(not(target_arch = "arm"))] @@ -66,7 +66,7 @@ pub unsafe fn enable() { asm!("cpsie i" : : - : + : "memory" : "volatile"); } #[cfg(not(target_arch = "arm"))] @@ -81,10 +81,6 @@ pub struct CriticalSection { _0: (), } -macro_rules! barrier { - () => { asm!("" ::: "memory" : "volatile") } -} - /// Execute closure `f` in an interrupt-free context. /// /// This as also known as a "critical section". @@ -97,9 +93,7 @@ where // disable interrupts disable(); - unsafe { barrier!() } let r = f(&CriticalSection { _0: () }); - unsafe { barrier!() } // If the interrupts were active before our `disable` call, then re-enable // them. Otherwise, keep them disabled -- cgit v1.2.3