Skip to content

Commit 980b51c

Browse files
bors[bot]khrs
andauthored
Merge #46
46: Do not panic on unknown trap mode. r=Disasm a=khrs Some vendors (eg Nuclei) use reserved bits for they own interrupt handling. Co-authored-by: Karol Harasim <[email protected]>
2 parents 3df404c + fc896ca commit 980b51c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/register/mtvec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ impl Mtvec {
2525
}
2626

2727
/// Returns the trap-vector mode
28-
pub fn trap_mode(&self) -> TrapMode {
28+
pub fn trap_mode(&self) -> Option<TrapMode> {
2929
let mode = self.bits & 0b11;
3030
match mode {
31-
0 => TrapMode::Direct,
32-
1 => TrapMode::Vectored,
33-
_ => unimplemented!(),
31+
0 => Some(TrapMode::Direct),
32+
1 => Some(TrapMode::Vectored),
33+
_ => None,
3434
}
3535
}
3636
}

0 commit comments

Comments
 (0)