MIT 6.828 JOS Lab 3 Report

MIT 6.828: JOS Lab

Lab 3

Part A: User Environments and Exception Handling


Answer the following questions:

  1. What is the purpose of having an individual handler function for each exception/interrupt? (i.e., if all exceptions/interrupts were delivered to the same handler, what feature that exists in the current implementation could not be provided?)
  2. Did you have to do anything to make the user/softint program behave correctly? The grade script expects it to produce a general protection fault (trap 13), but softint's code says int $14. Why should this produce interrupt vector 13? What happens if the kernel actually allows softint'sint $14 instruction to invoke the kernel's page fault handler (which is interrupt vector 14)?
  1. To maintain privilege isolation between kernel and user programs. If all interrupts were delivered to the same handler, there would be no way to assign different permissions to different handlers.
  2. No. softint produces interrupt 13 because it doesn't have permissions to invoke a page fault. And thus the processor catches that mismatch and then raises a general protection fault.

Part B: Page Faults, Breakpoints Exceptions, and System Calls


  1. The break point test case will either generate a break point exception or a general protection fault depending on how you initialized the break point entry in the IDT (i.e., your call to SETGATE from trap_init). Why? How do you need to set it up in order to get the breakpoint exception to work as specified above and what incorrect setup would cause it to trigger a general protection fault?
  2. What do you think is the point of these mechanisms, particularly in light of what the user/softint test program does?
  1. Because the permission set for the break point exception is user. If set to kernel, the CPU will raise a general protection fault.
  2. The point of these mechanisms is to restrict the influence user level code can have on the kernel. Users can set break points but can not directly manipulate virtual memories.