00001 // translate.h 00002 // Data structures for managing the translation from 00003 // virtual page # -> physical page #, used for managing 00004 // physical memory on behalf of user programs. 00005 // 00006 // The data structures in this file are "dual-use" - they 00007 // serve both as a page table entry, and as an entry in 00008 // a software-managed translation lookaside buffer (TLB). 00009 // Either way, each entry is of the form: 00010 // <virtual page #, physical page #>. 00011 // 00012 // DO NOT CHANGE -- part of the machine emulation 00013 // 00014 // Copyright (c) 1992-1993 The Regents of the University of California. 00015 // All rights reserved. See copyright.h for copyright notice and limitation 00016 // of liability and disclaimer of warranty provisions. 00017 00018 #ifndef TLB_H 00019 #define TLB_H 00020 00021 #include "copyright.h" 00022 #include "utility.h" 00023 00024 // The following class defines an entry in a translation table -- either 00025 // in a page table or a TLB. Each entry defines a mapping from one 00026 // virtual page to one physical page. 00027 // In addition, there are some extra bits for access control (valid and 00028 // read-only) and some bits for usage information (use and dirty). 00029 00030 class TranslationEntry { 00031 public: 00032 int virtualPage; // The page number in virtual memory. 00033 int physicalPage; // The page number in real memory (relative to the 00034 // start of "mainMemory" 00035 bool valid; // If this bit is set, the translation is ignored. 00036 // (In other words, the entry hasn't been initialized.) 00037 bool readOnly; // If this bit is set, the user program is not allowed 00038 // to modify the contents of the page. 00039 bool use; // This bit is set by the hardware every time the 00040 // page is referenced or modified. 00041 bool dirty; // This bit is set by the hardware every time the 00042 // page is modified. 00043 }; 00044 00045 #endif