1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-27 02:03:29 +04:00
rCore/kernel/src/trap.rs
2018-11-11 23:08:59 +08:00

26 lines
495 B
Rust

use process::*;
use arch::interrupt::TrapFrame;
use arch::cpu;
pub static mut TICK: usize = 0;
pub fn timer() {
if cpu::id() == 0 {
unsafe { TICK += 1; }
}
processor().tick();
}
pub fn error(tf: &TrapFrame) -> ! {
error!("{:#x?}", tf);
let pid = processor().pid();
error!("On CPU{} Process {}", cpu::id(), pid);
processor().manager().exit(pid, 0x100);
processor().yield_now();
unreachable!();
}
pub fn serial(c: char) {
::fs::STDIN.push(c);
}