diff --git a/kern/trap.c b/kern/trap.c index e27b556..7f6075f 100644 --- a/kern/trap.c +++ b/kern/trap.c @@ -59,14 +59,26 @@ static const char *trapname(int trapno) } +// XYZ: write a function declaration here... +// e.g., void t_divide(); + void trap_init(void) { extern struct Segdesc gdt[]; + /* + * + * HINT + * Do something like this: SETGATE(idt[T_DIVIDE], 0, GD_KT, t_divide, 0); + * if your trap handler's name for divide by zero is t_device. + * Additionally, you should declare trap handler as a function + * to refer that in C code... (see the comment XYZ above) + * + */ // LAB 3: Your code here. - // Per-CPU setup + // Per-CPU setup trap_init_percpu(); } diff --git a/kern/trapentry.S b/kern/trapentry.S index 22fc640..80dfe58 100644 --- a/kern/trapentry.S +++ b/kern/trapentry.S @@ -47,9 +47,15 @@ * Lab 3: Your code here for generating entry points for the different traps. */ - +// HINT 1 : TRAPHANDLER_NOEC(t_divide, T_DIVIDE); +// Do something like this if there is no error code for the trap +// HINT 2 : TRAPHANDLER(t_dblflt, T_DBLFLT); +// Do something like this if the trap includes an error code.. +// HINT 3 : READ Intel's manual to check if the trap includes an error code +// or not... /* * Lab 3: Your code here for _alltraps */ +