From 0e89d291abf713d17c79ec6ea01e46125bbd0253 Mon Sep 17 00:00:00 2001 From: Harry Cheng Date: Mon, 29 Jul 2019 21:37:38 +0800 Subject: [PATCH] Clearify exception --- kernel/src/arch/x86_64/interrupt/handler.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/src/arch/x86_64/interrupt/handler.rs b/kernel/src/arch/x86_64/interrupt/handler.rs index e1892a2..56461aa 100644 --- a/kernel/src/arch/x86_64/interrupt/handler.rs +++ b/kernel/src/arch/x86_64/interrupt/handler.rs @@ -108,7 +108,8 @@ pub extern "C" fn rust_trap(tf: &mut TrapFrame) { } Syscall32 => syscall32(tf), InvalidOpcode => invalid_opcode(tf), - DivideError | GeneralProtectionFault => error(tf), + DivideError => divide_error(tf), + GeneralProtectionFault => general_protection_fault(tf), IPIFuncCall => { let irq = tf.trap_num as u8 - IRQ0; super::ack(irq); // must ack before switching @@ -127,6 +128,16 @@ fn double_fault(tf: &TrapFrame) { loop {} } +fn divide_error(tf: &TrapFrame) { + error!("\nEXCEPTION: Divide Error"); + error(tf); +} + +fn general_protection_fault(tf: &TrapFrame) { + error!("\nEXCEPTION: General Protection Fault"); + error(tf); +} + fn page_fault(tf: &mut TrapFrame) { let addr: usize; unsafe {