package nachos.vm; import nachos.machine.*; import nachos.threads.*; import nachos.userprog.*; import nachos.vm.*; /** * A UserProcess that supports demand-paging. */ public class VMProcess extends UserProcess { /** * Allocate a new process. */ public VMProcess() { super(); } /** * Save the state of this process in preparation for a context switch. * Called by UThread.saveState(). */ public void saveState() { super.saveState(); } /** * Restore the state of this process after a context switch. Called by * UThread.restoreState(). */ public void restoreState() { super.restoreState(); } /** * Initializes page tables for this process so that the executable can be * demand-paged. * * @return true if successful. */ protected boolean loadSections() { return super.loadSections(); } /** * Release any resources allocated by loadSections(). */ protected void unloadSections() { super.unloadSections(); } /** * Handle a user exception. Called by * UserKernel.exceptionHandler(). The * cause argument identifies which exception occurred; see the * Processor.exceptionZZZ constants. * * @param cause the user exception that occurred. */ public void handleException(int cause) { Processor processor = Machine.processor(); switch (cause) { default: super.handleException(cause); break; } } private static final int pageSize = Processor.pageSize; private static final char dbgProcess = 'a'; private static final char dbgVM = 'v'; }