00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- 00002 00003 #ifndef boot_info_h 00004 #define boot_info_h 00005 00006 #include "initcalls.h" 00007 00008 #include "multiboot.h" 00009 #include "types.h" 00010 00011 // 00012 // INTERFACE definition follows 00013 // 00014 00015 00016 class Boot_info 00017 { 00018 public: 00019 static void init() FIASCO_INIT; 00020 private: 00021 00022 public: 00023 00024 static Address mbi_phys(); 00025 00026 static Multiboot_info * const mbi_virt(); 00027 private: 00028 00029 private: 00030 static Address _mbi_pa; 00031 static unsigned _flag; 00032 static unsigned _checksum_ro; 00033 static unsigned _checksum_rw; 00034 static Multiboot_info _kmbi; 00035 00036 public: 00037 static inline Address kmem_start(Address mem_max); 00038 00040 00048 static inline void set_flags(unsigned aflags); 00049 00050 static inline void set_checksum_ro(unsigned ro_cs); 00051 00052 static inline void set_checksum_rw(unsigned rw_cs); 00053 00054 static inline unsigned get_flags(void); 00055 00056 static inline unsigned get_checksum_ro(void); 00057 00058 static inline unsigned get_checksum_rw(void); 00059 00060 static void reset_checksum_ro(void); 00061 00062 static inline void set_mbi_phys(Address phys); 00063 00064 static unsigned long kmemsize(); 00065 }; 00066 /* IA32 Specific Boot info */ 00067 00068 00069 // 00070 // IMPLEMENTATION includes follow (for use by inline functions) 00071 // 00072 00073 00074 #include "config.h" 00075 #include "mem_layout.h" 00076 00077 // 00078 // IMPLEMENTATION of inline functions (and needed classes) 00079 // 00080 00081 00082 00083 00084 inline Address 00085 Boot_info::kmem_start(Address mem_max) 00086 { 00087 Address end_addr = (mbi_virt()->mem_upper + 1024) << 10; 00088 Address size, base; 00089 00090 if (end_addr > mem_max) 00091 end_addr = mem_max; 00092 00093 size = kmemsize(); 00094 if (!size) 00095 { 00096 size = end_addr / 100 * Config::kernel_mem_per_cent; 00097 if (size > Config::kernel_mem_max) 00098 size = Config::kernel_mem_max; 00099 } 00100 00101 base = end_addr - size & Config::PAGE_MASK; 00102 if (Mem_layout::phys_to_pmem(base) < Mem_layout::Physmem) 00103 base = Mem_layout::pmem_to_phys(Mem_layout::Physmem); 00104 00105 return base; 00106 } 00107 00108 00109 00111 00119 00120 inline void Boot_info::set_flags(unsigned aflags) 00121 { _flag = aflags; } 00122 00123 00124 00125 inline void Boot_info::set_checksum_ro(unsigned ro_cs) 00126 { _checksum_ro = ro_cs; } 00127 00128 00129 00130 inline void Boot_info::set_checksum_rw(unsigned rw_cs) 00131 { _checksum_rw = rw_cs; } 00132 00133 00134 00135 inline unsigned 00136 Boot_info::get_flags(void) 00137 { 00138 return _flag; 00139 } 00140 00141 00142 00143 inline unsigned 00144 Boot_info::get_checksum_ro(void) 00145 { 00146 return _checksum_ro; 00147 } 00148 00149 00150 00151 inline unsigned 00152 Boot_info::get_checksum_rw(void) 00153 { 00154 return _checksum_rw; 00155 } 00156 00157 00158 00159 inline void 00160 Boot_info::set_mbi_phys(Address phys) 00161 { 00162 _mbi_pa = phys; 00163 } 00164 00165 00166 00167 inline Address 00168 Boot_info::mbi_phys(void) 00169 { 00170 return _mbi_pa; 00171 } 00172 00173 00174 00175 inline Multiboot_info * const 00176 Boot_info::mbi_virt() 00177 { 00178 return &_kmbi; 00179 } 00180 00181 #endif // boot_info_h