|
@@ -83,7 +83,7 @@ impl Mstatus {
|
|
|
#[inline]
|
|
|
pub fn read() -> Mstatus {
|
|
|
match () {
|
|
|
- #[cfg(target_arch = "riscv")]
|
|
|
+ #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
|
|
|
() => {
|
|
|
let r: usize;
|
|
|
unsafe {
|
|
@@ -91,31 +91,31 @@ pub fn read() -> Mstatus {
|
|
|
}
|
|
|
Mstatus { bits: r }
|
|
|
}
|
|
|
- #[cfg(not(target_arch = "riscv"))]
|
|
|
+ #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
|
|
|
() => unimplemented!(),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// Sets the CSR
|
|
|
-#[cfg_attr(not(target_arch = "riscv"), allow(unused_variables))]
|
|
|
+#[cfg_attr(not(any(target_arch = "riscv32", target_arch = "riscv64")), allow(unused_variables))]
|
|
|
#[inline]
|
|
|
unsafe fn set(bits: usize) {
|
|
|
match () {
|
|
|
- #[cfg(target_arch = "riscv")]
|
|
|
+ #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
|
|
|
() => asm!("csrrs x0, 0x300, $0" :: "r"(bits) :: "volatile"),
|
|
|
- #[cfg(not(target_arch = "riscv"))]
|
|
|
+ #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
|
|
|
() => unimplemented!(),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// Clears the CSR
|
|
|
-#[cfg_attr(not(target_arch = "riscv"), allow(unused_variables))]
|
|
|
+#[cfg_attr(not(any(target_arch = "riscv32", target_arch = "riscv64")), allow(unused_variables))]
|
|
|
#[inline]
|
|
|
unsafe fn clear(bits: usize) {
|
|
|
match () {
|
|
|
- #[cfg(target_arch = "riscv")]
|
|
|
+ #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
|
|
|
() => asm!("csrrc x0, 0x300, $0" :: "r"(bits) :: "volatile"),
|
|
|
- #[cfg(not(target_arch = "riscv"))]
|
|
|
+ #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
|
|
|
() => unimplemented!(),
|
|
|
}
|
|
|
}
|