os/sbi.rs
1//! SBI call wrappers
2
3/// use sbi call to putchar in console (qemu uart handler)
4pub fn console_putchar(c: usize) {
5 #[allow(deprecated)]
6 sbi_rt::legacy::console_putchar(c);
7}
8
9/// use sbi call to set timer
10pub fn set_timer(timer: usize) {
11 sbi_rt::set_timer(timer as _);
12}
13
14/// use sbi call to shutdown the kernel
15pub fn shutdown(failure: bool) -> ! {
16 use sbi_rt::{NoReason, Shutdown, SystemFailure, system_reset};
17 if !failure {
18 system_reset(Shutdown, NoReason);
19 } else {
20 system_reset(Shutdown, SystemFailure);
21 }
22 unreachable!()
23}