CS 377: Operating Systems - MIPS Simulator

UMass Computer Science, Fall 2012


Setting up the MIPS simulator

In order to compile the Nachos test programs, you need a MIPS cross-compiler. A cross-compiler is a compiler that runs on one architecture but compiles to another architecture, e.g. a compiler that runs on x86 Solaris machines such as torus.cs but builds MIPS programs. You will be making use of a MIPS cross-compiler for Nachos, unless you actually run Nachos on a MIPS machine (unlikely).

When you run gmake/make in the test directory, make will look for a cross-compiler in the directory pointed at by the ARCHDIR environment variable.

If you are using the EdLab machines, they have tcsh so you would add the following to the .cshrc file under your home directory

setenv ARCHDIR /path/to/mips-xgcc
set path=( $ARCHDIR $path )

or if you want your EdLab account to use bash instead ot tcsh, you can simply put

/bin/bash
into your .cshrc file (and then add the bash entries above to .bashrc).

NOTE: This may break the original gcc you had because mips-gcc will now appear first in your PATH. If you want to use your regular gcc, you'll need to comment out the second line.


Download

Here are a collection of cross-compilers provided by UCB. Most likely you will not have to build one of your own:

If you do need to build your own cross-compiler, instruction to do so are here.

NOTE on OS X 10.7/10.8 The x86.macosx version does not work on OS X 10.7 or 10.8, as Rosetta is no longer supported. You will have to either use the Linux EdLab machines, or dual boot with Windows and use the Windows version. You should be able to get Windows from OIT here.


EdLab Machines

You may use the EdLab Linux workstations for the projects (remote access): elnux1 - elnux7 . cs.umass.edu

All students will have an account. Most account names are the same as your OIT username (not your cs department username if you have one). In case of name conflict some usernames will be first character of the first name appended by the lastname (truncated at 8 characters).

The initial passwords will be ELxxxaaa - where xxx is the last 3 digits of the ID number, and aaa is the first 3 characters/digits of the username. (unless you had an account last semester, then it will be whatever you set it to last semester).


Testing the cross-compiler

Once the cross-compiler is installed, you can test it by going into proj2 and running 'make test', which should build the test programs. If you get an error like 'gmake: not found', then open up the Makefile in the base nachos/ directory and change the word 'gmake' on line 52 to just 'make' and try again.

Once the test programs are built (as well as Nachos itself, by running make), try running ../bin/nachos from within proj2 - once you enter q, Nachos will execute halt.coff and should halt without throwing any errors. By default, proj2 executes the halt.coff file within tests/, but you can also specify a different file (e.g., mv.coff) by running ../bin/nachos -x mv.coff. Remember that most system call definitions are missing, so most operations will initially throw exceptions within Nachos.