Properly end process on error

master
Harry Cheng 5 years ago
parent 88e4c2c178
commit b4b3cd20b2

@ -18,17 +18,18 @@ pub fn timer() {
processor().tick(); processor().tick();
} }
pub fn error(tf: &TrapFrame) -> ! { pub fn error(tf: &mut TrapFrame) -> ! {
use crate::arch::syscall::*;
error!("{:#x?}", tf); error!("{:#x?}", tf);
let tid = processor().tid(); let tid = processor().tid();
error!("On CPU{} Thread {}", cpu::id(), tid); error!("On CPU{} Thread {}", cpu::id(), tid);
processor().manager().exit(tid, 0x100); crate::syscall::syscall(SYS_EXIT_GROUP, [0x100, 0, 0, 0, 0, 0], tf);
processor().yield_now();
unreachable!(); unreachable!();
} }
pub fn serial(c: char) { pub fn serial(c: char) {
trace!("Serial input: {:X}", c as u8);
if c == '\r' { if c == '\r' {
// in linux, we use '\n' instead // in linux, we use '\n' instead
crate::fs::STDIN.push('\n'); crate::fs::STDIN.push('\n');

Loading…
Cancel
Save