1 /* IA32/AMD64 Specific Boot info */
2 INTERFACE[ia32,ux,amd64]:
8 EXTENSION class Boot_info
12 static Address mbi_phys();
14 static Multiboot_info *mbi_virt();
18 //-------------------------------------------------------------------------
19 INTERFACE[ia32,amd64]:
21 EXTENSION class Boot_info
24 static Address _mbi_pa;
25 static unsigned _flag;
26 static unsigned _checksum_ro;
27 static unsigned _checksum_rw;
28 static Multiboot_info _kmbi;
32 //-------------------------------------------------------------------------
37 #include "mem_layout.h"
41 Boot_info::kmem_start(Address mem_max)
43 Address end_addr = (mbi_virt()->mem_upper + 1024) << 10;
46 if (end_addr > mem_max)
49 size = Koptions::o()->kmemsize << 10;
52 size = end_addr / 100 * Config::kernel_mem_per_cent;
53 if (size > Config::kernel_mem_max)
54 size = Config::kernel_mem_max;
57 base = end_addr - size & Config::PAGE_MASK;
58 if (Mem_layout::phys_to_pmem(base) < Mem_layout::Physmem)
59 base = Mem_layout::pmem_to_phys(Mem_layout::Physmem);
65 //-----------------------------------------------------------------------------
66 IMPLEMENTATION[ia32,amd64]:
72 #include "mem_layout.h"
74 // these members needs to be initialized with some
75 // data to go into the data section and not into bss
76 Address Boot_info::_mbi_pa = 125;
77 unsigned Boot_info::_flag = 3;
78 unsigned Boot_info::_checksum_ro = 15;
79 unsigned Boot_info::_checksum_rw = 16;
81 // initialized after startup cleaned out the bss
83 Multiboot_info Boot_info::_kmbi;
86 /// \defgroup pre init setup
88 * The Boot_info object must be set up with these functions
89 * before Boot_info::init() is called!
90 * This can be done either in __main, if booted on hardware
91 * or in an initializer with a higher priority than BOOT_INFO_INIT_PRIO
92 * (e.g UX_STARTUP1_INIT_PRIO) if the kernel runs on software (FIASCO-UX)
97 void Boot_info::set_flags(unsigned aflags)
101 void Boot_info::set_checksum_ro(unsigned ro_cs)
102 { _checksum_ro = ro_cs; }
105 void Boot_info::set_checksum_rw(unsigned rw_cs)
106 { _checksum_rw = rw_cs; }
114 // we assume that we run in 1:1 mapped mode
115 _kmbi = *(Multiboot_info *)mbi_phys();
120 Boot_info::get_flags(void)
127 Boot_info::get_checksum_ro(void)
134 Boot_info::get_checksum_rw(void)
141 Boot_info::reset_checksum_ro(void)
143 set_checksum_ro(Checksum::get_checksum_ro());
148 Boot_info::set_mbi_phys(Address phys)
155 Boot_info::mbi_phys(void)
162 Boot_info::mbi_virt()