File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -161,19 +161,19 @@ extern "C" fn call_handlers(
161
161
let cs = & mut cs;
162
162
let new_tcb = match cause. excode ( ) {
163
163
Excode :: Interrupt => call_irq_handlers ( tcb, cs) ,
164
- Excode :: Syscall | Excode :: Breakpoint => {
165
- if cause. branch_delay_slot ( ) {
166
- unsafe {
167
- asm ! ( "addiu $k1, 4" ) ;
168
- }
164
+ Excode :: Breakpoint => {
165
+ // SAFETY: Return to EPC+4 to avoid reexecuting the break instruction
166
+ unsafe {
167
+ asm ! ( "addiu $k1, 4" ) ;
169
168
}
170
- if cause. excode ( ) == Excode :: Syscall {
171
- syscall_handler ( cs, r4, r5)
172
- } else {
173
- println ! ( "{:#x?}" , tcb) ;
174
- ptr:: null_mut ( )
169
+ // SAFETY: tcb passed in by exception handler comes from CURRENT_THREAD which is
170
+ // always safe to dereference
171
+ unsafe {
172
+ println ! ( "{:#x?}" , * tcb) ;
175
173
}
174
+ ptr:: null_mut ( )
176
175
} ,
176
+ Excode :: Syscall => syscall_handler ( cs, r4, r5) ,
177
177
_ => unreachable ! ( "" ) ,
178
178
} ;
179
179
new_tcb
You can’t perform that action at this time.
0 commit comments