Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

mapdb.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef mapdb_h
00004 #define mapdb_h
00005 
00006 #include "types.h"
00007 
00008 //
00009 // INTERFACE definition follows 
00010 //
00011 
00012 
00013 struct Mapping_tree;            // forward decls
00014 class Mapdb_tree;
00015 class Physframe;
00016 
00017 class Mapdb_defs
00018 {
00019 public:
00020   enum {
00021     slab_align = 1,
00022   };
00023 };
00024 
00025 class Mapping_entry
00026 {
00027 public:
00028   unsigned space:11;            
00029   unsigned size:1;              
00030   unsigned address:20;          
00031   unsigned depth:8;             
00032 
00033 public:  
00034   inline bool space_is_sigma0();
00035   
00036   inline void set_space_to_sigma0();
00037 } __attribute__((packed));
00038 
00039 enum Mapping_type { Map_mem = 0, Map_io };
00040 
00053 class Mapping 
00054 {
00055   friend class Mapdb;
00056   friend class Mapping_tree;
00057   friend class Jdb_mapdb;
00058   friend struct Physframe;
00059 
00060   // CREATORS
00061   Mapping(const Mapping&);      // this constructor is undefined.
00062 
00063   // DATA
00064   Mapping_entry _data __attribute__((packed));
00065 
00066 public:  
00070   inline unsigned space();
00071   
00075   inline Address vaddr();
00076   
00080   inline size_t size();
00081   
00086   inline Mapping_type type();
00087   
00091   Mapping * parent();
00092   
00099   Mapping * next_iter();
00100   
00108   Mapping * next_child(Mapping *parent);
00109   
00110   inline bool space_is_sigma0();
00111 
00112 private:  
00113   inline Mapping();
00114   
00115   inline Mapping_entry * data();
00116   
00120   inline bool unused();
00121   
00122   inline bool is_end_tag();
00123   
00124   inline Mapping * next(const Mapping* end_of_tree);
00125   
00126   // A utility function to find the tree header belonging to a mapping. 
00127   // XXX This should probably be a static member of Mapping_tree to reduce 
00128   // coupling between Mapping and Mapping_tree.
00129   
00133   Mapping_tree * tree();
00134 };
00135 
00138 class Mapdb
00139 {
00140   friend class Jdb_mapdb;
00141 
00142 private:
00143   // DATA
00144 #if 0
00145   Mapdb_tree* _tree;
00146 #else
00147   Physframe* physframe;
00148 #endif
00149   Address _start;
00150 
00151 
00152 public:  
00153   // 
00154   // class Mapdb
00155   // 
00156   
00161   Mapdb(Address start, Address end);
00162   
00164   ~Mapdb();
00165   
00183   static Mapping * insert(Mapping *parent, unsigned space, Address va, size_t size, Mapping_type type);
00184   
00198   Mapping * lookup(unsigned space, Address va, Address phys);   // Mapping_type type
00199   
00212   void free(Mapping* mapping_of_tree);
00213   
00220   static void flush(Mapping *m, bool me_too);
00221   
00228   void grant(Mapping *m, unsigned new_space, Address va);
00229   
00230   static inline bool valid_address(Address phys);
00231 };
00232 
00233 //
00234 // IMPLEMENTATION includes follow (for use by inline functions)
00235 //
00236 
00237 
00238 #include "config.h"
00239 #include "kip.h"
00240 
00241 //
00242 // IMPLEMENTATION of inline functions (and needed classes)
00243 //
00244 
00245 
00246 
00247 inline bool Mapping_entry::space_is_sigma0()
00248 { return space == Config::sigma0_taskno; }
00249 
00250 
00251 inline void Mapping_entry::set_space_to_sigma0()
00252 { space = Config::sigma0_taskno; }
00253 
00254 
00255 
00256 inline Mapping_entry *
00257 Mapping::data()
00258 {
00259   return &_data;
00260 }
00261 
00262 
00267 inline unsigned
00268 Mapping::space()
00269 {
00270   return data()->space;
00271 }
00272 
00273 
00278 inline Address 
00279 Mapping::vaddr()
00280 {
00281   return (data()->address << Config::PAGE_SHIFT);
00282 }
00283 
00284 
00289 inline size_t 
00290 Mapping::size()
00291 {
00292   return data()->size
00293          ? Config::SUPERPAGE_SIZE
00294          : Config::PAGE_SIZE;
00295 }
00296 
00297 
00303 inline Mapping_type 
00304 Mapping::type()
00305 {
00306   // return data()->type;;
00307   return Map_mem;
00308 }
00309 
00310 
00311 
00312 inline bool
00313 Mapping::space_is_sigma0()
00314 {
00315   return space() == Config::sigma0_taskno;
00316 }
00317 
00318 
00319 
00320 inline bool
00321 Mapdb::valid_address(Address phys)
00322 {
00323   return !Config::Mapdb_ram_only || phys < Kip::k()->main_memory_high();
00324 }
00325 
00326 #endif // mapdb_h

Generated on Mon Sep 26 14:20:11 2005 for Fiasco by  doxygen 1.4.2