Main Page | Alphabetical List | Class List | File List | Class Members | File Members

machine.h File Reference

#include "copyright.h"
#include "utility.h"
#include "translate.h"
#include "disk.h"

Go to the source code of this file.

Classes

class  Instruction
class  Machine

Defines

#define PageSize   SectorSize
#define NumPhysPages   32
#define MemorySize   (NumPhysPages * PageSize)
#define TLBSize   4
#define StackReg   29
#define RetAddrReg   31
#define NumGPRegs   32
#define HiReg   32
#define LoReg   33
#define PCReg   34
#define NextPCReg   35
#define PrevPCReg   36
#define LoadReg   37
#define LoadValueReg   38
#define BadVAddrReg   39
#define NumTotalRegs   40

Enumerations

enum  ExceptionType {
  NoException, SyscallException, PageFaultException, ReadOnlyException,
  BusErrorException, AddressErrorException, OverflowException, IllegalInstrException,
  NumExceptionTypes
}

Functions

void ExceptionHandler (ExceptionType which)
unsigned int WordToHost (unsigned int word)
unsigned short ShortToHost (unsigned short shortword)
unsigned int WordToMachine (unsigned int word)
unsigned short ShortToMachine (unsigned short shortword)


Define Documentation

#define BadVAddrReg   39
 

Definition at line 70 of file machine.h.

Referenced by Machine::RaiseException().

#define HiReg   32
 

Definition at line 63 of file machine.h.

Referenced by Machine::DumpState(), and Machine::OneInstruction().

#define LoadReg   37
 

Definition at line 68 of file machine.h.

Referenced by Machine::DelayedLoad(), Machine::DumpState(), and Machine::OneInstruction().

#define LoadValueReg   38
 

Definition at line 69 of file machine.h.

Referenced by Machine::DelayedLoad(), Machine::DumpState(), and Machine::OneInstruction().

#define LoReg   33
 

Definition at line 64 of file machine.h.

Referenced by Machine::DumpState(), and Machine::OneInstruction().

#define MemorySize   (NumPhysPages * PageSize)
 

Definition at line 36 of file machine.h.

Referenced by Machine::Machine(), and Machine::Translate().

#define NextPCReg   35
 

Definition at line 66 of file machine.h.

Referenced by Machine::DumpState(), and Machine::OneInstruction().

#define NumGPRegs   32
 

Definition at line 62 of file machine.h.

Referenced by Machine::DumpState().

#define NumPhysPages   32
 

Definition at line 35 of file machine.h.

Referenced by Machine::Translate().

#define NumTotalRegs   40
 

Definition at line 72 of file machine.h.

Referenced by Machine::Machine(), Machine::ReadRegister(), and Machine::WriteRegister().

#define PageSize   SectorSize
 

Definition at line 31 of file machine.h.

Referenced by Machine::Translate().

#define PCReg   34
 

Definition at line 65 of file machine.h.

Referenced by Machine::DumpState(), and Machine::OneInstruction().

#define PrevPCReg   36
 

Definition at line 67 of file machine.h.

Referenced by Machine::DumpState(), and Machine::OneInstruction().

#define RetAddrReg   31
 

Definition at line 61 of file machine.h.

Referenced by Machine::DumpState().

#define StackReg   29
 

Definition at line 60 of file machine.h.

Referenced by Machine::DumpState().

#define TLBSize   4
 

Definition at line 37 of file machine.h.

Referenced by Machine::Machine(), and Machine::Translate().


Enumeration Type Documentation

enum ExceptionType
 

Enumeration values:
NoException 
SyscallException 
PageFaultException 
ReadOnlyException 
BusErrorException 
AddressErrorException 
OverflowException 
IllegalInstrException 
NumExceptionTypes 
Definition at line 39 of file machine.h.

Referenced by Machine::ReadMem(), and Machine::WriteMem().

00039 { NoException, // Everything ok! 00040 SyscallException, // A program executed a system call. 00041 PageFaultException, // No valid translation found 00042 ReadOnlyException, // Write attempted to page marked 00043 // "read-only" 00044 BusErrorException, // Translation resulted in an 00045 // invalid physical address 00046 AddressErrorException, // Unaligned reference or one that 00047 // was beyond the end of the 00048 // address space 00049 OverflowException, // Integer overflow in add or sub. 00050 IllegalInstrException, // Unimplemented or reserved instr. 00051 00052 NumExceptionTypes 00053 };


Function Documentation

void ExceptionHandler ExceptionType  which  ) 
 

Referenced by Machine::RaiseException().

unsigned short ShortToHost unsigned short  shortword  ) 
 

Definition at line 56 of file translate.cc.

Referenced by Machine::ReadMem(), and ShortToMachine().

00056 { 00057 #ifdef HOST_IS_BIG_ENDIAN 00058 register unsigned short result; 00059 result = (shortword << 8) & 0xff00; 00060 result |= (shortword >> 8) & 0x00ff; 00061 return result; 00062 #else 00063 return shortword; 00064 #endif /* HOST_IS_BIG_ENDIAN */ 00065 }

unsigned short ShortToMachine unsigned short  shortword  ) 
 

Definition at line 71 of file translate.cc.

References ShortToHost().

Referenced by Machine::WriteMem().

00071 { return ShortToHost(shortword); }

unsigned int WordToHost unsigned int  word  ) 
 

Definition at line 42 of file translate.cc.

Referenced by Machine::ReadMem(), and WordToMachine().

00042 { 00043 #ifdef HOST_IS_BIG_ENDIAN 00044 register unsigned long result; 00045 result = (word >> 24) & 0x000000ff; 00046 result |= (word >> 8) & 0x0000ff00; 00047 result |= (word << 8) & 0x00ff0000; 00048 result |= (word << 24) & 0xff000000; 00049 return result; 00050 #else 00051 return word; 00052 #endif /* HOST_IS_BIG_ENDIAN */ 00053 }

unsigned int WordToMachine unsigned int  word  ) 
 

Definition at line 68 of file translate.cc.

References WordToHost().

Referenced by Machine::WriteMem().

00068 { return WordToHost(word); }


Generated on Thu Sep 16 12:33:46 2004 for NachOS by doxygen 1.3.8