diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ctxt.rs | 10 | ||||
-rw-r--r-- | src/exception.rs | 18 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/ctxt.rs b/src/ctxt.rs index 0a05ecb..4650ff6 100644 --- a/src/ctxt.rs +++ b/src/ctxt.rs @@ -25,9 +25,17 @@ where } /// Acquires a reference to the context local data - pub fn borrow<'a>(&'static self, _ctxt: &'a Ctxt) -> &'a T { + pub fn borrow<'ctxt>(&'static self, _ctxt: &'ctxt Ctxt) -> &'ctxt T { unsafe { &*self.data.get() } } + + /// Acquires a mutable reference to the context local data + pub fn borrow_mut<'ctxt>( + &'static self, + _ctxt: &'ctxt mut Ctxt, + ) -> &'ctxt mut T { + unsafe { &mut *self.data.get() } + } } unsafe impl<T, Ctxt> Sync for Local<T, Ctxt> diff --git a/src/exception.rs b/src/exception.rs index d32d61f..2c4b1be 100644 --- a/src/exception.rs +++ b/src/exception.rs @@ -54,25 +54,25 @@ impl Exception { #[repr(C)] pub struct Handlers { /// Non-maskable interrupt - pub nmi: unsafe extern "C" fn(&Nmi), + pub nmi: unsafe extern "C" fn(Nmi), /// All class of fault - pub hard_fault: unsafe extern "C" fn(&HardFault), + pub hard_fault: unsafe extern "C" fn(HardFault), /// Memory management - pub mem_manage: unsafe extern "C" fn(&MemManage), + pub mem_manage: unsafe extern "C" fn(MemManage), /// Pre-fetch fault, memory access fault - pub bus_fault: unsafe extern "C" fn(&BusFault), + pub bus_fault: unsafe extern "C" fn(BusFault), /// Undefined instruction or illegal state - pub usage_fault: unsafe extern "C" fn(&UsageFault), + pub usage_fault: unsafe extern "C" fn(UsageFault), /// Reserved spots in the vector table pub _reserved0: [Reserved; 4], /// System service call via SWI instruction - pub svcall: unsafe extern "C" fn(&Svcall), + pub svcall: unsafe extern "C" fn(Svcall), /// Reserved spots in the vector table pub _reserved1: [Reserved; 2], /// Pendable request for system service - pub pendsv: unsafe extern "C" fn(&Pendsv), + pub pendsv: unsafe extern "C" fn(Pendsv), /// System tick timer - pub sys_tick: unsafe extern "C" fn(&SysTick), + pub sys_tick: unsafe extern "C" fn(SysTick), } /// Non-maskable interrupt @@ -150,7 +150,7 @@ pub const DEFAULT_HANDLERS: Handlers = Handlers { // This needs asm!, #[naked] and unreachable() to avoid modifying the stack // pointer (MSP), that way it points to the stacked registers #[naked] -pub unsafe extern "C" fn default_handler<T>(_token: &T) { +pub unsafe extern "C" fn default_handler<T>(_token: T) { // This is the actual exception handler. `_sf` is a pointer to the previous // stack frame #[cfg(target_arch = "arm")] |