Skip to content

Commit

Permalink
adapt riscv-rt to new approach
Browse files Browse the repository at this point in the history
  • Loading branch information
romancardenas committed Jun 7, 2024
1 parent 36b29ec commit 32bd8cd
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions riscv-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,23 +523,21 @@ pub unsafe extern "C" fn start_trap_rust(trap_frame: *const TrapFrame) {
fn _dispatch_interrupt(code: usize);
}

let cause = xcause::read();
let code = cause.code();

if cause.is_exception() {
let trap_frame = &*trap_frame;
if code < __EXCEPTIONS.len() {
let h = &__EXCEPTIONS[code];
if let Some(handler) = h {
handler(trap_frame);
match xcause::read().cause() {
xcause::Trap::Interrupt(code) => _dispatch_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);
}
} else {
ExceptionHandler(trap_frame);
}
} else {
_dispatch_interrupt(code);
}
}

Expand Down

0 comments on commit 32bd8cd

Please sign in to comment.