Deleted Added
full compact
bootinfo32.c (59087) bootinfo32.c (59854)
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/boot/i386/libi386/bootinfo32.c 59087 2000-04-08 01:22:14Z ps $
26 * $FreeBSD: head/sys/boot/i386/libi386/bootinfo32.c 59854 2000-05-01 17:41:25Z bp $
27 */
28
29#include <stand.h>
30#include <sys/param.h>
31#include <sys/reboot.h>
32#include <sys/linker.h>
33#include <machine/bootinfo.h>
34#include "bootstrap.h"

--- 163 unchanged lines hidden (view full) ---

198#define MOD_END(a) { \
199 COPY32(MODINFO_END, a); \
200 COPY32(0, a); \
201}
202
203vm_offset_t
204bi_copymodules(vm_offset_t addr)
205{
27 */
28
29#include <stand.h>
30#include <sys/param.h>
31#include <sys/reboot.h>
32#include <sys/linker.h>
33#include <machine/bootinfo.h>
34#include "bootstrap.h"

--- 163 unchanged lines hidden (view full) ---

198#define MOD_END(a) { \
199 COPY32(MODINFO_END, a); \
200 COPY32(0, a); \
201}
202
203vm_offset_t
204bi_copymodules(vm_offset_t addr)
205{
206 struct loaded_module *mp;
207 struct module_metadata *md;
206 struct preloaded_file *fp;
207 struct file_metadata *md;
208
209 /* start with the first module on the list, should be the kernel */
208
209 /* start with the first module on the list, should be the kernel */
210 for (mp = mod_findmodule(NULL, NULL); mp != NULL; mp = mp->m_next) {
210 for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) {
211
211
212 MOD_NAME(addr, mp->m_name); /* this field must come first */
213 MOD_TYPE(addr, mp->m_type);
214 if (mp->m_args)
215 MOD_ARGS(addr, mp->m_args);
216 MOD_ADDR(addr, mp->m_addr);
217 MOD_SIZE(addr, mp->m_size);
218 for (md = mp->m_metadata; md != NULL; md = md->md_next)
212 MOD_NAME(addr, fp->f_name); /* this field must come first */
213 MOD_TYPE(addr, fp->f_type);
214 if (fp->f_args)
215 MOD_ARGS(addr, fp->f_args);
216 MOD_ADDR(addr, fp->f_addr);
217 MOD_SIZE(addr, fp->f_size);
218 for (md = fp->f_metadata; md != NULL; md = md->md_next)
219 if (!(md->md_type & MODINFOMD_NOCOPY))
220 MOD_METADATA(addr, md);
221 }
222 MOD_END(addr);
223 return(addr);
224}
225
226/*
227 * Load the information expected by an i386 kernel.
228 *
229 * - The 'boothowto' argument is constructed
230 * - The 'botdev' argument is constructed
231 * - The 'bootinfo' struct is constructed, and copied into the kernel space.
232 * - The kernel environment is copied into kernel space.
233 * - Module metadata are formatted and placed in kernel space.
234 */
235int
236bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
237{
219 if (!(md->md_type & MODINFOMD_NOCOPY))
220 MOD_METADATA(addr, md);
221 }
222 MOD_END(addr);
223 return(addr);
224}
225
226/*
227 * Load the information expected by an i386 kernel.
228 *
229 * - The 'boothowto' argument is constructed
230 * - The 'botdev' argument is constructed
231 * - The 'bootinfo' struct is constructed, and copied into the kernel space.
232 * - The kernel environment is copied into kernel space.
233 * - Module metadata are formatted and placed in kernel space.
234 */
235int
236bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
237{
238 struct loaded_module *xp;
238 struct preloaded_file *xp;
239 struct i386_devdesc *rootdev;
240 vm_offset_t addr, bootinfo_addr;
241 char *rootdevname;
242 int bootdevnr, i;
243 u_int pad;
244 char *kernelname;
245 const char *kernelpath;
246

--- 43 unchanged lines hidden (view full) ---

290 bi.bi_bios_geom[i] = bd_getbigeom(i);
291 bi.bi_size = sizeof(bi);
292 bi.bi_memsizes_valid = 1;
293 bi.bi_basemem = bios_basemem / 1024;
294 bi.bi_extmem = bios_extmem / 1024;
295
296 /* find the last module in the chain */
297 addr = 0;
239 struct i386_devdesc *rootdev;
240 vm_offset_t addr, bootinfo_addr;
241 char *rootdevname;
242 int bootdevnr, i;
243 u_int pad;
244 char *kernelname;
245 const char *kernelpath;
246

--- 43 unchanged lines hidden (view full) ---

290 bi.bi_bios_geom[i] = bd_getbigeom(i);
291 bi.bi_size = sizeof(bi);
292 bi.bi_memsizes_valid = 1;
293 bi.bi_basemem = bios_basemem / 1024;
294 bi.bi_extmem = bios_extmem / 1024;
295
296 /* find the last module in the chain */
297 addr = 0;
298 for (xp = mod_findmodule(NULL, NULL); xp != NULL; xp = xp->m_next) {
299 if (addr < (xp->m_addr + xp->m_size))
300 addr = xp->m_addr + xp->m_size;
298 for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
299 if (addr < (xp->f_addr + xp->f_size))
300 addr = xp->f_addr + xp->f_size;
301 }
302 /* pad to a page boundary */
303 pad = (u_int)addr & PAGE_MASK;
304 if (pad != 0) {
305 pad = PAGE_SIZE - pad;
306 addr += pad;
307 }
308

--- 29 unchanged lines hidden ---
301 }
302 /* pad to a page boundary */
303 pad = (u_int)addr & PAGE_MASK;
304 if (pad != 0) {
305 pad = PAGE_SIZE - pad;
306 addr += pad;
307 }
308

--- 29 unchanged lines hidden ---