Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

AddrSpace Class Reference

Data structures to keep track of executing user programs (address spaces). More...

#include <addrspace.h>

List of all members.

Public Methods

 AddrSpace ()
 Create an address space. More...

 ~AddrSpace ()
 De-allocate an address space. More...

void Execute (char *fileName)
 Run the the program stored in the file "executable". More...

void SaveState ()
 Save address space-specific info on a context switch. More...

void RestoreState ()
 Restore address space-specific info on a context switch. More...


Private Methods

bool Load (char *fileName)
 Load the program into memory return false if not found. More...

void InitRegisters ()
 Initialize user-level CPU registers, before jumping to user code. More...


Private Attributes

TranslationEntrypageTable
 Assume linear page table translation for now! More...

unsigned int numPages
 Number of pages in the virtual address space. More...


Detailed Description

Data structures to keep track of executing user programs (address spaces).

Definition at line 24 of file addrspace.h.


Constructor & Destructor Documentation

AddrSpace::AddrSpace ( )
 

Create an address space.

AddrSpace::AddrSpace Create an address space to run a user program. Set up the translation from program memory to physical memory. For now, this is really simple (1:1), since we are only uniprogramming, and we have a single unsegmented page table

Definition at line 54 of file addrspace.cc.

AddrSpace::~AddrSpace ( )
 

De-allocate an address space.

AddrSpace::~AddrSpace Dealloate an address space.

Definition at line 75 of file addrspace.cc.


Member Function Documentation

void AddrSpace::Execute ( char * fileName )
 

Run the the program stored in the file "executable".

AddrSpace::Execute Run a user program. Load the executable into memory, then (for now) use our own thread to run it.

"fileName" is the file containing the object code to load into memory

Definition at line 152 of file addrspace.cc.

Referenced by UserProgKernel::Run().

void AddrSpace::InitRegisters ( ) [private]
 

Initialize user-level CPU registers, before jumping to user code.

AddrSpace::InitRegisters Set the initial values for the user-level register set.

We write these directly into the "machine" registers, so that we can immediately jump to user code. Note that these will be saved/restored into the currentThread->userRegisters when this thread is context switched out.

Definition at line 182 of file addrspace.cc.

Referenced by Execute().

bool AddrSpace::Load ( char * fileName ) [private]
 

Load the program into memory return false if not found.

AddrSpace::Load Load a user program into memory from a file.

Assumes that the page table has been initialized, and that the object code file is in NOFF format.

"fileName" is the file containing the object code to load into memory

Definition at line 92 of file addrspace.cc.

Referenced by Execute().

void AddrSpace::RestoreState ( )
 

Restore address space-specific info on a context switch.

AddrSpace::RestoreState On a context switch, restore the machine state so that this address space can run.

For now, tell the machine where to find the page table.

Definition at line 223 of file addrspace.cc.

Referenced by Execute().

void AddrSpace::SaveState ( )
 

Save address space-specific info on a context switch.

AddrSpace::SaveState On a context switch, save any machine state, specific to this address space, that needs saving.

For now, don't need to save anything!

Definition at line 212 of file addrspace.cc.


Member Data Documentation

unsigned int AddrSpace::numPages [private]
 

Number of pages in the virtual address space.

Definition at line 40 of file addrspace.h.

TranslationEntry * AddrSpace::pageTable [private]
 

Assume linear page table translation for now!

Definition at line 38 of file addrspace.h.


The documentation for this class was generated from the following files:
Generated at Wed Jul 4 11:32:23 2001 for Nachos by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001