Small Fix && cargo fmt
This commit is contained in:
parent
c9583b0f53
commit
ae3ba9c26f
83 changed files with 1085 additions and 1079 deletions
|
@ -1,28 +1,18 @@
|
|||
mod context;
|
||||
|
||||
use riscv::register::{
|
||||
mtvec::TrapMode,
|
||||
stvec,
|
||||
scause::{
|
||||
self,
|
||||
Trap,
|
||||
Exception,
|
||||
Interrupt,
|
||||
},
|
||||
stval,
|
||||
sie,
|
||||
};
|
||||
use crate::config::TRAMPOLINE;
|
||||
use crate::syscall::syscall;
|
||||
use crate::task::{
|
||||
exit_current_and_run_next,
|
||||
current_trap_cx, current_trap_cx_user_va, current_user_token, exit_current_and_run_next,
|
||||
suspend_current_and_run_next,
|
||||
current_user_token,
|
||||
current_trap_cx,
|
||||
current_trap_cx_user_va,
|
||||
};
|
||||
use crate::timer::{set_next_trigger, check_timer};
|
||||
use crate::config::TRAMPOLINE;
|
||||
use core::arch::{global_asm, asm};
|
||||
use crate::timer::{check_timer, set_next_trigger};
|
||||
use core::arch::{asm, global_asm};
|
||||
use riscv::register::{
|
||||
mtvec::TrapMode,
|
||||
scause::{self, Exception, Interrupt, Trap},
|
||||
sie, stval, stvec,
|
||||
};
|
||||
|
||||
global_asm!(include_str!("trap.S"));
|
||||
|
||||
|
@ -43,7 +33,9 @@ fn set_user_trap_entry() {
|
|||
}
|
||||
|
||||
pub fn enable_timer_interrupt() {
|
||||
unsafe { sie::set_stimer(); }
|
||||
unsafe {
|
||||
sie::set_stimer();
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -62,12 +54,12 @@ pub fn trap_handler() -> ! {
|
|||
cx = current_trap_cx();
|
||||
cx.x[10] = result as usize;
|
||||
}
|
||||
Trap::Exception(Exception::StoreFault) |
|
||||
Trap::Exception(Exception::StorePageFault) |
|
||||
Trap::Exception(Exception::InstructionFault) |
|
||||
Trap::Exception(Exception::InstructionPageFault) |
|
||||
Trap::Exception(Exception::LoadFault) |
|
||||
Trap::Exception(Exception::LoadPageFault) => {
|
||||
Trap::Exception(Exception::StoreFault)
|
||||
| Trap::Exception(Exception::StorePageFault)
|
||||
| Trap::Exception(Exception::InstructionFault)
|
||||
| Trap::Exception(Exception::InstructionPageFault)
|
||||
| Trap::Exception(Exception::LoadFault)
|
||||
| Trap::Exception(Exception::LoadPageFault) => {
|
||||
println!(
|
||||
"[kernel] {:?} in application, bad addr = {:#x}, bad instruction = {:#x}, kernel killed it.",
|
||||
scause.cause(),
|
||||
|
@ -88,7 +80,11 @@ pub fn trap_handler() -> ! {
|
|||
suspend_current_and_run_next();
|
||||
}
|
||||
_ => {
|
||||
panic!("Unsupported trap {:?}, stval = {:#x}!", scause.cause(), stval);
|
||||
panic!(
|
||||
"Unsupported trap {:?}, stval = {:#x}!",
|
||||
scause.cause(),
|
||||
stval
|
||||
);
|
||||
}
|
||||
}
|
||||
trap_return();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue