124 |
|
|
125 |
/* Never reached. */ |
/* Never reached. */ |
126 |
} |
} |
127 |
|
|
128 |
|
|
129 |
|
/* The following must be defined and are used to calculate the extents |
130 |
|
of the laden binary itself. */ |
131 |
|
extern char _start; |
132 |
|
extern char _end; |
133 |
|
|
134 |
|
|
135 |
|
/* Find the kernel, the initial servers and the other information |
136 |
|
required for booting. */ |
137 |
|
void |
138 |
|
find_components (void) |
139 |
|
{ |
140 |
|
multiboot_info_t *mbi = (multiboot_info_t *) l4_boot_info (); |
141 |
|
l4_word_t start; |
142 |
|
l4_word_t end; |
143 |
|
|
144 |
|
#if 0 |
145 |
|
debug_dump (); |
146 |
|
#endif |
147 |
|
|
148 |
|
/* Load the module information. */ |
149 |
|
if (CHECK_FLAG (mbi->flags, 3)) |
150 |
|
{ |
151 |
|
module_t *mod = (module_t *) mbi->mods_addr; |
152 |
|
|
153 |
|
if (mbi->mods_count > 0) |
154 |
|
{ |
155 |
|
/* Skip the entry for the rootserver. */ |
156 |
|
mod++; |
157 |
|
} |
158 |
|
|
159 |
|
if (mbi->mods_count > 1) |
160 |
|
{ |
161 |
|
physmem.low = mod->mod_start; |
162 |
|
physmem.high = mod->mod_end; |
163 |
|
mod++; |
164 |
|
} |
165 |
|
} |
166 |
|
|
167 |
|
/* Now protect ourselves and the mulitboot info (at least the module |
168 |
|
configuration. */ |
169 |
|
loader_add_region (program_name, (l4_word_t) &_start, (l4_word_t) &_end); |
170 |
|
|
171 |
|
start = (l4_word_t) mbi; |
172 |
|
end = start + sizeof (*mbi) - 1; |
173 |
|
loader_add_region ("grub-mbi", start, end); |
174 |
|
|
175 |
|
if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count) |
176 |
|
{ |
177 |
|
module_t *mod = (module_t *) mbi->mods_addr; |
178 |
|
int nr; |
179 |
|
|
180 |
|
start = (l4_word_t) mod; |
181 |
|
end = ((l4_word_t) mod) + mbi->mods_count * sizeof (*mod); |
182 |
|
loader_add_region ("grub-mods", start, end); |
183 |
|
|
184 |
|
start = (l4_word_t) mod[0].string; |
185 |
|
end = start; |
186 |
|
for (nr = 0; nr < mbi->mods_count; nr++) |
187 |
|
{ |
188 |
|
char *str = (char *) mod[nr].string; |
189 |
|
|
190 |
|
if (str) |
191 |
|
{ |
192 |
|
if (((l4_word_t) str) < start) |
193 |
|
start = (l4_word_t) str; |
194 |
|
while (*str) |
195 |
|
str++; |
196 |
|
if (((l4_word_t) str) > end) |
197 |
|
end = (l4_word_t) str; |
198 |
|
} |
199 |
|
} |
200 |
|
loader_add_region ("grub-mods-cmdlines", start, end); |
201 |
|
} |
202 |
|
} |