rcore-tutorial/os/src/sbi.rs
2023-03-29 22:47:44 +08:00

15 lines
393 B
Rust

/// use sbi call to set timer
pub fn set_timer(timer: usize) {
sbi_rt::set_timer(timer as _);
}
/// use sbi call to shutdown the kernel
pub fn shutdown(failure: bool) -> ! {
use sbi_rt::{system_reset, NoReason, Shutdown, SystemFailure};
if !failure {
system_reset(Shutdown, NoReason);
} else {
system_reset(Shutdown, SystemFailure);
}
unreachable!()
}