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 getchar from console (qemu uart handler)
10#[allow(unused)]
11pub fn console_getchar() -> usize {
12 #[allow(deprecated)]
13 sbi_rt::legacy::console_getchar()
14}
15
16/// use sbi call to shutdown the kernel
17pub fn shutdown(failure: bool) -> ! {
18 use sbi_rt::{NoReason, Shutdown, SystemFailure, system_reset};
19 if !failure {
20 system_reset(Shutdown, NoReason);
21 } else {
22 system_reset(Shutdown, SystemFailure);
23 }
24 unreachable!()
25}