next up previous contents
Next: Process Creation Up: A Road Map Through Previous: Special Notes

User-Level Processes

  Nachos runs user programs in their own private address space. Nachos can run any MIPS binary, assuming that it restricts itself to only making system calls that Nachos understands. In Unix, ``a.out'' files are stored in ``coff'' format. Nachos requires that executables be in the simpler ``Noff'' format. To convert binaries of one format to the other, use the coff2noff program. Consult the Makefile in the test directory for details.

Noff-format files consist of four parts. The first part, the Noff header, describes the contents of the rest of the file, giving information about the program's instructions, initialized variables and uninitialized variables.

The Noff header resides at the very start of the file and contains pointers to the remaining sections. Specifically, the Noff header contains:

noffMagic
A reserved ``magic'' number that indicates that the file is in Noff format. The magic number is stored in the first four bytes of the file. Before attempting to execute a user-program, Nachos checks the magic number to be sure that the file about to be executed is actually a Nachos executable.

For each of the remaining sections, Nachos maintains the following information:

virtualAddr
What virtual address that segment begins at (normally zero).
inFileAddr
Pointer within the Noff file where that section actually begins (so that Nachos can read it into memory before execution begins).
size
The size (in bytes) of that segment.

When executing a program, Nachos creates an address space and copies the contents of the instruction and initialized variable segments into the address space. Note that the uninitialized variable section does not need to be read from the file. Since it is defined to contain all zeros, Nachos simply allocates memory for it within the address space of the Nachos process and zeros it out.




next up previous contents
Next: Process Creation Up: A Road Map Through Previous: Special Notes

Thomas Narten
Mon Feb 3 15:00:27 EST 1997