aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exception.rs19
-rw-r--r--src/interrupt.rs5
2 files changed, 15 insertions, 9 deletions
diff --git a/src/exception.rs b/src/exception.rs
index 82401df..f5c8c28 100644
--- a/src/exception.rs
+++ b/src/exception.rs
@@ -153,7 +153,8 @@ pub const DEFAULT_HANDLERS: Handlers = Handlers {
// pointer (MSP), that way it points to the stacked registers
#[naked]
pub extern "C" fn default_handler<T>(_token: T)
- where T: Context
+where
+ T: Context,
{
// This is the actual exception handler. `_sf` is a pointer to the previous
// stack frame
@@ -167,16 +168,18 @@ pub extern "C" fn default_handler<T>(_token: T)
match () {
#[cfg(target_arch = "arm")]
() => {
- // "trampoline" to get to the real exception handler.
- asm!("mrs r0, MSP
+ unsafe {
+ // "trampoline" to get to the real exception handler.
+ asm!("mrs r0, MSP
ldr r1, [r0, #20]
b $0"
- :
- : "i"(handler as extern "C" fn(&StackedRegisters) -> !)
- :
- : "volatile");
+ :
+ : "i"(handler as extern "C" fn(&StackedRegisters) -> !)
+ :
+ : "volatile");
- ::core::intrinsics::unreachable()
+ ::core::intrinsics::unreachable()
+ }
}
#[cfg(not(target_arch = "arm"))]
() => {}
diff --git a/src/interrupt.rs b/src/interrupt.rs
index 6c84301..e11fdc3 100644
--- a/src/interrupt.rs
+++ b/src/interrupt.rs
@@ -21,7 +21,10 @@ impl<T> Mutex<T> {
}
/// Mutably borrows the data for the duration of the critical section
- pub fn borrow_mut<'cs>(&self, _ctxt: &'cs mut CriticalSection) -> &'cs mut T {
+ pub fn borrow_mut<'cs>(
+ &self,
+ _ctxt: &'cs mut CriticalSection,
+ ) -> &'cs mut T {
unsafe { &mut *self.inner.get() }
}
}