2020-03-11 09:49:03 +00:00
|
|
|
use riscv::register::{satp, sie, sstatus};
|
2020-03-10 04:04:17 +00:00
|
|
|
use xous::PID;
|
|
|
|
|
|
|
|
|
|
pub mod exception;
|
|
|
|
|
pub mod irq;
|
|
|
|
|
pub mod mem;
|
2020-03-16 10:22:59 +00:00
|
|
|
pub mod process;
|
2020-03-10 04:04:17 +00:00
|
|
|
pub mod syscall;
|
|
|
|
|
|
2020-06-16 08:34:49 +00:00
|
|
|
pub use process::Context;
|
2020-03-10 04:04:17 +00:00
|
|
|
|
|
|
|
|
pub fn current_pid() -> PID {
|
|
|
|
|
satp::read().asid() as PID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn init() {
|
|
|
|
|
unsafe {
|
|
|
|
|
sstatus::set_sie();
|
|
|
|
|
sie::set_ssoft();
|
|
|
|
|
sie::set_sext();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-03 07:34:55 +00:00
|
|
|
pub fn idle() {
|
2020-03-11 09:49:03 +00:00
|
|
|
unsafe { riscv::asm::wfi() };
|
|
|
|
|
}
|