@@ -54,25 +54,25 @@ impl Exception {
54
54
#[ repr( C ) ]
55
55
pub struct Handlers {
56
56
/// Non-maskable interrupt
57
- pub nmi : unsafe extern "C" fn ( Nmi ) ,
57
+ pub nmi : extern "C" fn ( Nmi ) ,
58
58
/// All class of fault
59
- pub hard_fault : unsafe extern "C" fn ( HardFault ) ,
59
+ pub hard_fault : extern "C" fn ( HardFault ) ,
60
60
/// Memory management
61
- pub mem_manage : unsafe extern "C" fn ( MemManage ) ,
61
+ pub mem_manage : extern "C" fn ( MemManage ) ,
62
62
/// Pre-fetch fault, memory access fault
63
- pub bus_fault : unsafe extern "C" fn ( BusFault ) ,
63
+ pub bus_fault : extern "C" fn ( BusFault ) ,
64
64
/// Undefined instruction or illegal state
65
- pub usage_fault : unsafe extern "C" fn ( UsageFault ) ,
65
+ pub usage_fault : extern "C" fn ( UsageFault ) ,
66
66
/// Reserved spots in the vector table
67
67
pub _reserved0 : [ Reserved ; 4 ] ,
68
68
/// System service call via SWI instruction
69
- pub svcall : unsafe extern "C" fn ( Svcall ) ,
69
+ pub svcall : extern "C" fn ( Svcall ) ,
70
70
/// Reserved spots in the vector table
71
71
pub _reserved1 : [ Reserved ; 2 ] ,
72
72
/// Pendable request for system service
73
- pub pendsv : unsafe extern "C" fn ( Pendsv ) ,
73
+ pub pendsv : extern "C" fn ( Pendsv ) ,
74
74
/// System tick timer
75
- pub sys_tick : unsafe extern "C" fn ( SysTick ) ,
75
+ pub sys_tick : extern "C" fn ( SysTick ) ,
76
76
}
77
77
78
78
/// Non-maskable interrupt
@@ -123,6 +123,8 @@ unsafe impl Context for MemManage {}
123
123
124
124
unsafe impl Context for BusFault { }
125
125
126
+ unsafe impl Context for UsageFault { }
127
+
126
128
unsafe impl Context for Svcall { }
127
129
128
130
unsafe impl Context for Pendsv { }
@@ -150,7 +152,9 @@ pub const DEFAULT_HANDLERS: Handlers = Handlers {
150
152
// This needs asm!, #[naked] and unreachable() to avoid modifying the stack
151
153
// pointer (MSP), that way it points to the stacked registers
152
154
#[ naked]
153
- pub unsafe extern "C" fn default_handler < T > ( _token : T ) {
155
+ pub extern "C" fn default_handler < T > ( _token : T )
156
+ where T : Context
157
+ {
154
158
// This is the actual exception handler. `_sf` is a pointer to the previous
155
159
// stack frame
156
160
#[ cfg( target_arch = "arm" ) ]
0 commit comments