Merge branch 'lab4' into lab5
This commit is contained in:
@@ -22,6 +22,7 @@ struct Command {
|
||||
int (*func)(int argc, char** argv, struct Trapframe* tf);
|
||||
};
|
||||
|
||||
// LAB 1: add your command to here...
|
||||
static struct Command commands[] = {
|
||||
{ "help", "Display this list of commands", mon_help },
|
||||
{ "kerninfo", "Display information about the kernel", mon_kerninfo },
|
||||
@@ -58,7 +59,9 @@ mon_kerninfo(int argc, char **argv, struct Trapframe *tf)
|
||||
int
|
||||
mon_backtrace(int argc, char **argv, struct Trapframe *tf)
|
||||
{
|
||||
// Your code here.
|
||||
// LAB 1: Your code here.
|
||||
// HINT 1: use read_ebp().
|
||||
// HINT 2: print the current ebp on the first line (not current_ebp[0])
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ sched_halt(void)
|
||||
"movl %0, %%esp\n"
|
||||
"pushl $0\n"
|
||||
"pushl $0\n"
|
||||
// LAB 4:
|
||||
// Uncomment the following line after completing exercise 13
|
||||
//"sti\n"
|
||||
"1:\n"
|
||||
|
||||
14
kern/trap.c
14
kern/trap.c
@@ -66,14 +66,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user