tac0S
Template Affectional Command Operating System
|
Data structures for simulating the execution of user programs running on top of Nachos. More...
Go to the source code of this file.
Classes | |
class | Instruction |
The following class defines an instruction, represented in both undecoded binary form decoded to identify operation to do registers to act on any immediate operand value. More... | |
class | Machine |
The following 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! More... | |
Functions | |
void | ExceptionHandler (ExceptionType which) |
ExceptionHandler Entry point into the Nachos kernel. Called when a user program is executing, and either does a syscall, or generates an addressing or arithmetic exception. More... | |
unsigned int | WordToHost (unsigned int word) |
Routines for converting Words and Short Words to and from the simulated machine's format of little endian. These end up being NOPs when the host machine is also little endian (DEC and Intel). | |
unsigned short | ShortToHost (unsigned short shortword) |
unsigned int | WordToMachine (unsigned int word) |
unsigned short | ShortToMachine (unsigned short shortword) |
Data structures for simulating the execution of user programs running on top of Nachos.
In Nachos, user programs are executed one instruction at a time, by the simulator. Each memory reference is translated, checked for errors, etc.
DO NOT CHANGE – part of the machine emulation
Copyright (c) 1992-1993 The Regents of the University of California. All rights reserved. See copyright.h for copyright notice and limitation of liability and disclaimer of warranty provisions.
void ExceptionHandler | ( | ExceptionType | which | ) |
ExceptionHandler Entry point into the Nachos kernel. Called when a user program is executing, and either does a syscall, or generates an addressing or arithmetic exception.
For system calls, the following is the calling convention:
system call code – r2 arg1 – r4 arg2 – r5 arg3 – r6 arg4 – r7
The result of the system call, if any, must be put back into r2.
And don't forget to increment the pc before returning. (Or else you'll loop making the same system call forever!
which | is the kind of exception. The list of possible exceptions are in machine.h. |