|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.machine.Machine
public class Machine
This class defines the simulated host workstation hardware, as seen by user programs -- the CPU registers, main memory, etc. User programs shouldn't be able to tell that they are running on our simulator or on the real hardware, except we don't support floating point instructions the system call interface to Nachos is not the same as UNIX (10 system calls in Nachos vs. 200 in UNIX!) If we were to implement more of the UNIX system calls, we ought to be able to run Nachos on top of Nachos!
Field Summary | |
---|---|
static int |
AddressErrorException
The exception generated when an unaligned reference is made, or a reference is made to an address that is beyond the end of the address space. |
static int |
BadVAddrReg
The failing virtual address on a page fault exception. |
static int |
BusErrorException
The exception generated when translation results in an invalid physical address. |
static java.lang.String[] |
exceptionNames
Names of the different types of exceptions -- for debugging. |
static int |
HiReg
Double register to hold the result of multiplication. |
static int |
IllegalInstrException
The exception generated by an attempt to execute an unimplemented or reserved (privileged) instruction. |
static int |
LoadReg
The register target of a delayed load. |
static int |
LoadValueReg
The value to be loaded by a delayed load. |
static int |
LoReg
|
static byte[] |
mainMemory
Physical memory to store user program, code and data, while executing. |
static int |
MemorySize
The total number of bytes of RAM on the system. |
static int |
NextPCReg
Next program counter (for branch delay). |
static int |
NoException
Not an exception -- everything OK! |
static int |
NumExceptionTypes
The number of different types of exceptions. |
static int |
NumGPRegs
Total number (32) of general purpose registers on MIPS. |
static int |
NumPhysPages
The number of pages of RAM on the system. |
static int |
NumSegments
Size of the segment table. |
static int |
NumTotalRegs
The total number of registers. |
static int |
OverflowException
The exception generated when an integer overflow occurs in add or sub. |
static int |
PageFaultException
The exception generated when a program accesses an unmapped page. |
static int |
PageSize
The size of a page is set equal to the disk sector size, for simplicity. |
static int |
PCReg
Current program counter. |
static int |
PrevPCReg
Previous program counter (for deuggin). |
static int |
R31
Register 31. |
static int |
ReadOnlyException
The exception generated when a program attempts a write to a page marked "read-only". |
static int |
RetAddrReg
Register that holds return address for procedure calls. |
static int |
SegmentSize
Maximum size of a segment. |
static int |
SIGN_BIT
Bitmask defining the position of the sign bit. |
static int |
StackReg
User's stack pointer. |
static nachos.Statistics |
stats
Collect statistics. |
static int |
SyscallException
The exception generated when a program executes a SYSCALL instruction. |
static int |
TLBSize
Number of entries in the TLB. |
Constructor Summary | |
---|---|
Machine()
|
Method Summary | |
---|---|
static void |
debugger()
Primitive debugger for user programs. |
static void |
dumpState()
Print the user program's CPU state. |
static void |
enableDebugging()
Turn on user-program debugging, which is off by default. |
static SegmentDescriptor[] |
getSegmentTable()
Obtain access to the segment table, if any. |
static TranslationEntry[] |
getTLB()
Obtain access to the TLB, if any. |
static void |
init(java.lang.String[] args)
Initialize the simulation of user program execution. |
static int |
readRegister(int num)
|
static void |
run()
Simulate the execution of a user-level program on Nachos. |
static void |
setHandler(ExceptionHandler handler)
Method called by the OS to register an exception handler to be used when a machine exception occurs in user mode. |
static void |
setPageTable(TranslationEntry[] table)
Install a new page table for address translation. |
static void |
writeRegister(int num,
int value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NumSegments
public static final int SegmentSize
public static final int TLBSize
public static final int PageSize
public static final int NumPhysPages
public static final int MemorySize
public static final int NoException
public static final int SyscallException
public static final int PageFaultException
public static final int ReadOnlyException
public static final int BusErrorException
public static final int AddressErrorException
public static final int OverflowException
public static final int IllegalInstrException
public static final int NumExceptionTypes
public static final java.lang.String[] exceptionNames
public static final int StackReg
public static final int RetAddrReg
public static final int NumGPRegs
public static final int HiReg
public static final int LoReg
public static final int PCReg
public static final int NextPCReg
public static final int PrevPCReg
public static final int LoadReg
public static final int LoadValueReg
public static final int BadVAddrReg
public static final int NumTotalRegs
public static final int SIGN_BIT
public static final int R31
public static final byte[] mainMemory
public static final nachos.Statistics stats
Constructor Detail |
---|
public Machine()
Method Detail |
---|
public static void init(java.lang.String[] args)
args
- Command line args given to main program.public static void enableDebugging()
public static SegmentDescriptor[] getSegmentTable()
public static TranslationEntry[] getTLB()
public static void setPageTable(TranslationEntry[] table)
table
- The new page table to be installed.public static void run()
public static void setHandler(ExceptionHandler handler)
handler
- Exception handler to be registered.public static void debugger()
public static void dumpState()
public static int readRegister(int num)
public static void writeRegister(int num, int value)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |