3.2 Processor

The Processor class simulates a MIPS processor that supports a subset of the R3000 instruction set. Nachos processor lacks co-processor support.

Implementation note: Nachos can not handle floating point operations.
mainMemory is byte-addressable and organized into 1KB pages. The actual number of pages used is controlled by the NumPhysPages in the config file. readMem and writeMem take virtual memory addresses as inputs to read and write the associated memory locations. Address translation is handled by the translate() method that translates virtual memory addresses to physical addresses Memory management will be detailed in Section 6.

The Processor class also allows a kernel to set an exception handler to be called on any user mode exception.

The Processor class maintains 38 software-accessible CPU registers including regPC and regSP for the program counter register and the stack pointer register. After loading a binary user program (in COFF) to the memory, the PC register is initialized to point to the program entry points, and the SP register points to the top of the stack.