Skip to content

Commit 3ecd11c

Browse files
committed
add Display impl for AsidOutOfRangeError
1 parent 861bbbf commit 3ecd11c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/instructions/tlb.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
},
1111
PrivilegeLevel, VirtAddr,
1212
};
13-
use core::{arch::asm, cmp, convert::TryFrom};
13+
use core::{arch::asm, cmp, convert::TryFrom, fmt};
1414

1515
/// Invalidate the given address in the TLB using the `invlpg` instruction.
1616
#[inline]
@@ -355,6 +355,16 @@ pub struct AsidOutOfRangeError {
355355
nasid: u32,
356356
}
357357

358+
impl fmt::Display for AsidOutOfRangeError {
359+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
360+
write!(
361+
f,
362+
"{} is out of the range of available ASIDS ({})",
363+
self.asid, self.nasid
364+
)
365+
}
366+
}
367+
358368
#[inline]
359369
unsafe fn flush_broadcast<S>(
360370
va_and_count: Option<(Page<S>, u16)>,

0 commit comments

Comments
 (0)