Add basic trap handlers
This commit is contained in:
parent
667f2df4cc
commit
6ab267bb9b
|
@ -100,7 +100,7 @@ trap_init(void)
|
|||
SETGATE(idt[T_DIVIDE], 0, GD_KT, t_divide, 0);
|
||||
SETGATE(idt[T_DEBUG], 0, GD_KT, t_debug, 0);
|
||||
SETGATE(idt[T_NMI], 0, GD_KT, t_nmi, 0);
|
||||
SETGATE(idt[T_BRKPT], 0, GD_KT, t_brkpt, 0);
|
||||
SETGATE(idt[T_BRKPT], 0, GD_KT, t_brkpt, 3);
|
||||
SETGATE(idt[T_OFLOW], 0, GD_KT, t_oflow, 0);
|
||||
SETGATE(idt[T_BOUND], 0, GD_KT, t_bound, 0);
|
||||
SETGATE(idt[T_ILLOP], 0, GD_KT, t_illop, 0);
|
||||
|
@ -196,6 +196,11 @@ trap_dispatch(struct Trapframe *tf)
|
|||
{
|
||||
// Handle processor exceptions.
|
||||
// LAB 3: Your code here.
|
||||
if (tf->tf_trapno == T_PGFLT) {
|
||||
page_fault_handler(tf);
|
||||
} else if (tf->tf_trapno == T_BRKPT) {
|
||||
monitor(tf);
|
||||
}
|
||||
|
||||
// Unexpected trap: The user process or the kernel has a bug.
|
||||
print_trapframe(tf);
|
||||
|
|
Loading…
Reference in New Issue
Block a user