[ RCOS.java Home | RCOS Home | David's Home ]

AddrSpace CRC

Name:

AddrSpace

Comment:

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

For now, we don't keep any information about address spaces. The user level CPU state is saved and restored in the thread executing the user program (see thread.h).

Collaborators:

Responsibilities:

class AddrSpace {
  public:
    AddrSpace(OpenFile *executable);    // Create an address space,
                                        // initializing it with the program
                                        // stored in the file "executable"
    ~AddrSpace();                       // De-allocate an address space

    void InitRegisters();               // Initialize user-level CPU registers,
                                        // before jumping to user code

    void SaveState();                   // Save/restore address space-specific
    void RestoreState();                // info on a context switch

  private:
    TranslationEntry *pageTable;        // Assume linear page table translation
                                        // for now!
    unsigned int numPages;              // Number of pages in the virtual
                                        // address space
};