Skip to content

Commit 4d16f14

Browse files
bors[bot]Disasm
andauthored
Merge #51
51: Fix {S,U}tvec::trap_mode() functions to match Mtvec::trap_mode() r=almindor a=Disasm See also: #50 (comment) Co-authored-by: Vadim Kaushan <admin@disasm.info>
2 parents 3b8b0ad + f844c17 commit 4d16f14

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
### Changed
1313

14-
- `Mtvec::trap_mode()` not returns `Option<TrapMode>` (breaking change)
14+
- `Mtvec::trap_mode()`, `Stvec::trap_mode()` and `Utvec::trap_mode()` functions now return `Option<TrapMode>` (breaking change)
1515
- Updated Minimum Supported Rust Version to 1.42.0
1616
- Use `llvm_asm!` instead of `asm!`
1717

src/register/stvec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ impl Stvec {
2020
}
2121

2222
/// Returns the trap-vector mode
23-
pub fn trap_mode(&self) -> TrapMode {
23+
pub fn trap_mode(&self) -> Option<TrapMode> {
2424
let mode = self.bits & 0b11;
2525
match mode {
26-
0 => TrapMode::Direct,
27-
1 => TrapMode::Vectored,
28-
_ => unimplemented!(),
26+
0 => Some(TrapMode::Direct),
27+
1 => Some(TrapMode::Vectored),
28+
_ => None,
2929
}
3030
}
3131
}

src/register/utvec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ impl Utvec {
2020
}
2121

2222
/// Returns the trap-vector mode
23-
pub fn trap_mode(&self) -> TrapMode {
23+
pub fn trap_mode(&self) -> Option<TrapMode> {
2424
let mode = self.bits & 0b11;
2525
match mode {
26-
0 => TrapMode::Direct,
27-
1 => TrapMode::Vectored,
28-
_ => unimplemented!(),
26+
0 => Some(TrapMode::Direct),
27+
1 => Some(TrapMode::Vectored),
28+
_ => None,
2929
}
3030
}
3131
}

0 commit comments

Comments
 (0)