aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-06-28 11:31:51 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-06-30 18:08:28 -0500
commita396a68a43e684b4388cfdcaa0caacbe0dcc4b71 (patch)
tree9aded1432ef1ea0a6353c7016c537bd0a884f948
parent93c901d7489ceeea4624b680e96c3e8867a9f08a (diff)
downloadcortex-m-a396a68a43e684b4388cfdcaa0caacbe0dcc4b71.tar.gz
cortex-m-a396a68a43e684b4388cfdcaa0caacbe0dcc4b71.tar.zst
cortex-m-a396a68a43e684b4388cfdcaa0caacbe0dcc4b71.zip
turn interrupt::{enable,disable} into compiler barriers
-rw-r--r--src/interrupt.rs10
1 files changed, 2 insertions, 8 deletions
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