|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.kernel.userprog.AddrSpace
public class AddrSpace
This class manages "address spaces", which are the contexts in which user programs execute. For now, an address space contains a "segment descriptor", which describes the the virtual-to-physical address mapping that is to be used when the user program is executing. As you implement more of Nachos, it will probably be necessary to add other fields to this class to keep track of things like open files, network connections, etc., in use by a user program. NOTE: Most of what is in currently this class assumes that just one user program at a time will be executing. You will have to rewrite this code so that it is suitable for multiprogramming.
Field Summary | |
---|---|
private nachos.machine.TranslationEntry[] |
pageTable
Page table that describes a virtual-to-physical address mapping. |
private static int |
UserStackSize
Default size of the user stack area -- increase this as necessary! |
Constructor Summary | |
---|---|
AddrSpace()
Create a new address space. |
Method Summary | |
---|---|
int |
exec(OpenFile executable)
Load the program from a file "executable", and set everything up so that we can start executing user instructions. |
void |
initRegisters()
Initialize the user-level register set to values appropriate for starting execution of a user program loaded in this address space. |
void |
restoreState()
On a context switch, restore any machine state specific to this address space. |
private long |
roundToPage(long size)
Utility method for rounding up to a multiple of Machine.PageSize; |
void |
saveState()
On a context switch, save any machine state, specific to this address space, that needs saving. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private nachos.machine.TranslationEntry[] pageTable
private static final int UserStackSize
Constructor Detail |
---|
public AddrSpace()
Method Detail |
---|
public int exec(OpenFile executable)
executable
- The file containing the object code to
load into memory
public void initRegisters()
public void saveState()
public void restoreState()
private long roundToPage(long size)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |