From f0e2ab8abdd9cf0f278c6c280c3638a802fd3721 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 23 Apr 2019 16:31:01 -0700 Subject: [PATCH] Do not crash on handled traps. --- kern/trap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kern/trap.c b/kern/trap.c index 2a4abef..8ed3fa8 100644 --- a/kern/trap.c +++ b/kern/trap.c @@ -198,8 +198,10 @@ trap_dispatch(struct Trapframe *tf) // LAB 3: Your code here. if (tf->tf_trapno == T_PGFLT) { page_fault_handler(tf); + return; } else if (tf->tf_trapno == T_BRKPT) { monitor(tf); + return; } else if (tf->tf_trapno == T_SYSCALL) { syscall(tf->tf_regs.reg_eax, tf->tf_regs.reg_edx, @@ -207,6 +209,7 @@ trap_dispatch(struct Trapframe *tf) tf->tf_regs.reg_ebx, tf->tf_regs.reg_edi, tf->tf_regs.reg_esi); + return; } // Unexpected trap: The user process or the kernel has a bug.