Skip to main content

os/
sbi.rs

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