remove XS and FS from ustatus

This commit is contained in:
Ales Katona 2019-08-31 16:10:56 -06:00
parent 13831f7a80
commit cdf6a33665
No known key found for this signature in database
GPG Key ID: 08C459E2D8ABB7E8
1 changed files with 0 additions and 39 deletions

View File

@ -2,8 +2,6 @@
// TODO: Virtualization, Memory Privilege and Extension Context Fields // TODO: Virtualization, Memory Privilege and Extension Context Fields
use bit_field::BitField; use bit_field::BitField;
use core::mem::size_of;
pub use super::mstatus::{XS, FS};
/// ustatus register /// ustatus register
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
@ -23,44 +21,7 @@ impl Ustatus {
pub fn upie(&self) -> bool { pub fn upie(&self) -> bool {
self.bits.get_bit(4) self.bits.get_bit(4)
} }
/// Floating-point extension state
///
/// Encodes the status of the floating-point unit,
/// including the CSR `fcsr` and floating-point data registers `f0f31`.
#[inline]
pub fn fs(&self) -> FS {
match self.bits.get_bits(13..15) {
0b00 => FS::Off,
0b01 => FS::Initial,
0b10 => FS::Clean,
0b11 => FS::Dirty,
_ => unreachable!(),
} }
}
/// Additional extension state
///
/// Encodes the status of additional user-mode extensions and associated state.
#[inline]
pub fn xs(&self) -> XS {
match self.bits.get_bits(15..17) {
0b00 => XS::AllOff,
0b01 => XS::NoneDirtyOrClean,
0b10 => XS::NoneDirtySomeClean,
0b11 => XS::SomeDirty,
_ => unreachable!(),
}
}
/// Whether either the FS field or XS field
/// signals the presence of some dirty state
#[inline]
pub fn sd(&self) -> bool {
self.bits.get_bit(size_of::<usize>() * 8 - 1)
}
}
read_csr_as!(Ustatus, 0x000, __read_ustatus); read_csr_as!(Ustatus, 0x000, __read_ustatus);
write_csr!(0x000, __write_ustatus); write_csr!(0x000, __write_ustatus);