Skip to content

Commit

Permalink
Update riscv-rt/src/lib.rs
Browse files Browse the repository at this point in the history
Co-authored-by: rmsyn <[email protected]>
  • Loading branch information
romancardenas and rmsyn authored Jul 4, 2024
1 parent e6df749 commit bb996a4
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions riscv-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,13 @@ pub unsafe extern "C" fn start_trap_rust(trap_frame: *const TrapFrame) {

match xcause::read().cause() {
xcause::Trap::Interrupt(code) => _dispatch_core_interrupt(code),
xcause::Trap::Exception(code) => {
let trap_frame = &*trap_frame;
if code < __EXCEPTIONS.len() {
let h = &__EXCEPTIONS[code];
if let Some(handler) = h {
handler(trap_frame);
} else {
ExceptionHandler(trap_frame);
}
} else {
ExceptionHandler(trap_frame);
xcause::Trap::Exception(code) if code < __EXCEPTIONS.len() => {
match __EXCEPTIONS[code].as_ref() {
Some(handler) => handler(&*trap_frame),
None => ExceptionHandler(&*trap_frame),
}
}
xcause::Trap::Exception(_) => ExceptionHandler(&*trap_frame),
}
}
}
Expand Down

0 comments on commit bb996a4

Please sign in to comment.