00001 // addrspace.h 00002 // Data structures to keep track of executing user programs 00003 // (address spaces). 00004 // 00005 // For now, we don't keep any information about address spaces. 00006 // The user level CPU state is saved and restored in the thread 00007 // executing the user program (see thread.h). 00008 // 00009 // Copyright (c) 1992-1993 The Regents of the University of California. 00010 // All rights reserved. See copyright.h for copyright notice and limitation 00011 // of liability and disclaimer of warranty provisions. 00012 00013 #ifndef ADDRSPACE_H 00014 #define ADDRSPACE_H 00015 00016 #include "copyright.h" 00017 #include "filesys.h" 00018 00019 #define UserStackSize 1024 // increase this as necessary! 00020 00021 class AddrSpace { 00022 public: 00023 AddrSpace(OpenFile *executable); // Create an address space, 00024 // initializing it with the program 00025 // stored in the file "executable" 00026 ~AddrSpace(); // De-allocate an address space 00027 00028 void InitRegisters(); // Initialize user-level CPU registers, 00029 // before jumping to user code 00030 00031 void SaveState(); // Save/restore address space-specific 00032 void RestoreState(); // info on a context switch 00033 00034 private: 00035 TranslationEntry *pageTable; // Assume linear page table translation 00036 // for now! 00037 unsigned int numPages; // Number of pages in the virtual 00038 // address space 00039 }; 00040 00041 #endif // ADDRSPACE_H
1.2.14 written by Dimitri van Heesch,
© 1997-2002