diff options
-rw-r--r-- | CHANGELOG.md | 12 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/interrupt.rs | 8 |
3 files changed, 19 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ea0fc..67373f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.2.5] - 2017-05-07 + +### Added + +- Higher level API for the SysTick and FPU peripherals + +### Fixed + +- MEMORY SAFETY. `interrupt::enable` was safe to call inside an + `interrupt::free` critical section thus breaking the preemption protection. + The `interrupt::enable` method is now `unsafe`. + ## [v0.2.4] - 2017-04-20 ### Fixed @@ -6,7 +6,7 @@ keywords = ["arm", "cortex-m", "register", "peripheral"] license = "MIT OR Apache-2.0" name = "cortex-m" repository = "https://github.com/japaric/cortex-m" -version = "0.2.4" +version = "0.2.5" [dependencies] volatile-register = "0.2.0" diff --git a/src/interrupt.rs b/src/interrupt.rs index a4eac00..412c483 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -47,8 +47,12 @@ pub fn disable() { } /// Enables all the interrupts +/// +/// # Safety +/// +/// - Do not call this function inside an `interrupt::free` critical section #[inline(always)] -pub fn enable() { +pub unsafe fn enable() { match () { #[cfg(target_arch = "arm")] () => unsafe { @@ -87,7 +91,7 @@ where // If the interrupts were active before our `disable` call, then re-enable // them. Otherwise, keep them disabled if primask.is_active() { - enable(); + unsafe { enable() } } r |