MIT 6.828 JOS Lab 3 Report
MIT 6.828: JOS Lab
Lab 3
Part A: User Environments and Exception Handling
Questions
Answer the following questions:
- 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?)
- Did you have to do anything to make the
user/softintprogram behave correctly? The grade script expects it to produce a general protection fault (trap 13), butsoftint's code saysint $14. Why should this produce interrupt vector 13? What happens if the kernel actually allowssoftint'sint $14instruction to invoke the kernel's page fault handler (which is interrupt vector 14)?
- 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.
- No.
softintproduces 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
Questions
- 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
SETGATEfromtrap_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?- What do you think is the point of these mechanisms, particularly in light of what the
user/softinttest program does?
- Because the permission set for the break point exception is user. If set to kernel, the CPU will raise a general protection fault.
- 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.