nachos.vm
Class VMProcess

java.lang.Object
  |
  +--nachos.userprog.UserProcess
        |
        +--nachos.vm.VMProcess
Direct Known Subclasses:
NetProcess

public class VMProcess
extends UserProcess

A UserProcess that supports demand-paging.


Fields inherited from class nachos.userprog.UserProcess
coff, numPages, pageTable, stackPages
 
Constructor Summary
VMProcess()
          Allocate a new process.
 
Method Summary
 void handleException(int cause)
          Handle a user exception.
 int handleSyscall(int syscall, int a0, int a1, int a2, int a3)
          Handle a syscall exception.
protected  boolean loadSections()
          Initializes page tables for this process so that the executable can be demand-paged.
 void restoreState()
          Restore the state of this process after a context switch.
 void saveState()
          Save the state of this process in preparation for a context switch.
protected  void unloadSections()
          Release any resources allocated by loadSections().
 
Methods inherited from class nachos.userprog.UserProcess
execute, initRegisters, newUserProcess, readVirtualMemory, readVirtualMemory, readVirtualMemoryString, writeVirtualMemory, writeVirtualMemory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VMProcess

public VMProcess()
Allocate a new process.
Method Detail

saveState

public void saveState()
Save the state of this process in preparation for a context switch. Called by UThread.saveState().
Overrides:
saveState in class UserProcess

restoreState

public void restoreState()
Restore the state of this process after a context switch. Called by UThread.restoreState().
Overrides:
restoreState in class UserProcess

loadSections

protected boolean loadSections()
Initializes page tables for this process so that the executable can be demand-paged.
Overrides:
loadSections in class UserProcess
Returns:
true if successful.

unloadSections

protected void unloadSections()
Release any resources allocated by loadSections().
Overrides:
unloadSections in class UserProcess

handleSyscall

public int handleSyscall(int syscall,
                         int a0,
                         int a1,
                         int a2,
                         int a3)
Handle a syscall exception. Called by handleException(). The syscall argument identifies which syscall the user executed:
syscall#syscall prototype
10int mmap(int fd, char *address);
Overrides:
handleSyscall in class UserProcess
Parameters:
syscall - the syscall number.
a0 - the first syscall argument.
a1 - the second syscall argument.
a2 - the third syscall argument.
a3 - the fourth syscall argument.
Returns:
the value to be returned to the user.

handleException

public void handleException(int cause)
Handle a user exception. Called by UserKernel.exceptionHandler(). The cause argument identifies which exception occurred; see the Processor.exceptionZZZ constants.
Overrides:
handleException in class UserProcess
Parameters:
cause - the user exception that occurred.