Skip to content

Commit 173b5bc

Browse files
author
Jorge Aparicio
committed
add unsafe block
1 parent 0856d2c commit 173b5bc

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/exception.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ pub const DEFAULT_HANDLERS: Handlers = Handlers {
153153
// pointer (MSP), that way it points to the stacked registers
154154
#[naked]
155155
pub extern "C" fn default_handler<T>(_token: T)
156-
where T: Context
156+
where
157+
T: Context,
157158
{
158159
// This is the actual exception handler. `_sf` is a pointer to the previous
159160
// stack frame
@@ -167,16 +168,18 @@ pub extern "C" fn default_handler<T>(_token: T)
167168
match () {
168169
#[cfg(target_arch = "arm")]
169170
() => {
170-
// "trampoline" to get to the real exception handler.
171-
asm!("mrs r0, MSP
171+
unsafe {
172+
// "trampoline" to get to the real exception handler.
173+
asm!("mrs r0, MSP
172174
ldr r1, [r0, #20]
173175
b $0"
174-
:
175-
: "i"(handler as extern "C" fn(&StackedRegisters) -> !)
176-
:
177-
: "volatile");
176+
:
177+
: "i"(handler as extern "C" fn(&StackedRegisters) -> !)
178+
:
179+
: "volatile");
178180

179-
::core::intrinsics::unreachable()
181+
::core::intrinsics::unreachable()
182+
}
180183
}
181184
#[cfg(not(target_arch = "arm"))]
182185
() => {}

src/interrupt.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ impl<T> Mutex<T> {
2121
}
2222

2323
/// Mutably borrows the data for the duration of the critical section
24-
pub fn borrow_mut<'cs>(&self, _ctxt: &'cs mut CriticalSection) -> &'cs mut T {
24+
pub fn borrow_mut<'cs>(
25+
&self,
26+
_ctxt: &'cs mut CriticalSection,
27+
) -> &'cs mut T {
2528
unsafe { &mut *self.inner.get() }
2629
}
2730
}

0 commit comments

Comments
 (0)