From b4b3cd20b2e285df675a7de1647cddac2efec519 Mon Sep 17 00:00:00 2001 From: Harry Cheng Date: Wed, 31 Jul 2019 12:48:01 +0800 Subject: [PATCH] Properly end process on error --- kernel/src/trap.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/src/trap.rs b/kernel/src/trap.rs index 037827a..4ec47eb 100644 --- a/kernel/src/trap.rs +++ b/kernel/src/trap.rs @@ -18,17 +18,18 @@ pub fn timer() { processor().tick(); } -pub fn error(tf: &TrapFrame) -> ! { +pub fn error(tf: &mut TrapFrame) -> ! { + use crate::arch::syscall::*; error!("{:#x?}", tf); let tid = processor().tid(); error!("On CPU{} Thread {}", cpu::id(), tid); - processor().manager().exit(tid, 0x100); - processor().yield_now(); + crate::syscall::syscall(SYS_EXIT_GROUP, [0x100, 0, 0, 0, 0, 0], tf); unreachable!(); } pub fn serial(c: char) { + trace!("Serial input: {:X}", c as u8); if c == '\r' { // in linux, we use '\n' instead crate::fs::STDIN.push('\n');