📄 vmprocess.java
字号:
package nachos.vm;import nachos.machine.*;import nachos.threads.*;import nachos.userprog.*;import nachos.vm.*;/** * A <tt>UserProcess</tt> 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 <tt>UThread.saveState()</tt>. */ public void saveState() { super.saveState(); } /** * Restore the state of this process after a context switch. Called by * <tt>UThread.restoreState()</tt>. */ public void restoreState() { super.restoreState(); } /** * Initializes page tables for this process so that the executable can be * demand-paged. * * @return <tt>true</tt> if successful. */ protected boolean loadSections() { return super.loadSections(); } /** * Release any resources allocated by <tt>loadSections()</tt>. */ protected void unloadSections() { super.unloadSections(); } private static final int syscallMmap = 10; /** * Handle a syscall exception. Called by <tt>handleException()</tt>. The * <i>syscall</i> argument identifies which syscall the user executed: * * <table> * <tr><td>syscall#</td><td>syscall prototype</td></tr> * <tr><td>10</td><td><tt>int mmap(int fd, char *address);</tt></td></tr> * </table> * * @param syscall the syscall number. * @param a0 the first syscall argument. * @param a1 the second syscall argument. * @param a2 the third syscall argument. * @param a3 the fourth syscall argument. * @return the value to be returned to the user. */ public int handleSyscall(int syscall, int a0, int a1, int a2, int a3) { switch (syscall) { default: return super.handleSyscall(syscall, a0, a1, a2, a3); } } /** * Handle a user exception. Called by * <tt>UserKernel.exceptionHandler()</tt>. The * <i>cause</i> argument identifies which exception occurred; see the * <tt>Processor.exceptionZZZ</tt> 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';}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -