Deleted Added
full compact
bootinfo32.c (59854) bootinfo32.c (64187)
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 59854 2000-05-01 17:41:25Z bp $
26 * $FreeBSD: head/sys/boot/i386/libi386/bootinfo32.c 64187 2000-08-03 09:14:02Z jhb $
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"
35#include "libi386.h"
36#include "btxv86.h"
37
38static struct bootinfo bi;
39
40/*
41 * Return a 'boothowto' value corresponding to the kernel arguments in
42 * (kargs) and any relevant environment variables.
43 */
44static struct
45{
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"
35#include "libi386.h"
36#include "btxv86.h"
37
38static struct bootinfo bi;
39
40/*
41 * Return a 'boothowto' value corresponding to the kernel arguments in
42 * (kargs) and any relevant environment variables.
43 */
44static struct
45{
46 char *ev;
46 const char *ev;
47 int mask;
48} howto_names[] = {
49 {"boot_askname", RB_ASKNAME},
50 {"boot_cdrom", RB_CDROM},
51 {"boot_userconfig", RB_CONFIG},
52 {"boot_ddb", RB_KDB},
53 {"boot_gdb", RB_GDB},
54 {"boot_single", RB_SINGLE},
55 {"boot_verbose", RB_VERBOSE},
56 {NULL, 0}
57};
58
47 int mask;
48} howto_names[] = {
49 {"boot_askname", RB_ASKNAME},
50 {"boot_cdrom", RB_CDROM},
51 {"boot_userconfig", RB_CONFIG},
52 {"boot_ddb", RB_KDB},
53 {"boot_gdb", RB_GDB},
54 {"boot_single", RB_SINGLE},
55 {"boot_verbose", RB_VERBOSE},
56 {NULL, 0}
57};
58
59vm_offset_t bi_copymodules(vm_offset_t addr);
60
59int
60bi_getboothowto(char *kargs)
61{
62 char *cp;
63 int howto;
64 int active;
65 int i;
66

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

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
61int
62bi_getboothowto(char *kargs)
63{
64 char *cp;
65 int howto;
66 int active;
67 int i;
68

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

224 MOD_END(addr);
225 return(addr);
226}
227
228/*
229 * Load the information expected by an i386 kernel.
230 *
231 * - The 'boothowto' argument is constructed
230 * - The 'botdev' argument is constructed
232 * - The 'bootdev' 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 preloaded_file *xp;
239 struct i386_devdesc *rootdev;
233 * - The 'bootinfo' struct is constructed, and copied into the kernel space.
234 * - The kernel environment is copied into kernel space.
235 * - Module metadata are formatted and placed in kernel space.
236 */
237int
238bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
239{
240 struct preloaded_file *xp;
241 struct i386_devdesc *rootdev;
240 vm_offset_t addr, bootinfo_addr;
242 vm_offset_t addr;
241 char *rootdevname;
242 int bootdevnr, i;
243 u_int pad;
244 char *kernelname;
245 const char *kernelpath;
246
247 *howtop = bi_getboothowto(args);
248

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

257 printf("can't determine root device\n");
258 return(EINVAL);
259 }
260
261 /* Try reading the /etc/fstab file to select the root device */
262 getrootmount(i386_fmtdev((void *)rootdev));
263
264 /* Do legacy rootdev guessing */
243 char *rootdevname;
244 int bootdevnr, i;
245 u_int pad;
246 char *kernelname;
247 const char *kernelpath;
248
249 *howtop = bi_getboothowto(args);
250

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

259 printf("can't determine root device\n");
260 return(EINVAL);
261 }
262
263 /* Try reading the /etc/fstab file to select the root device */
264 getrootmount(i386_fmtdev((void *)rootdev));
265
266 /* Do legacy rootdev guessing */
267
268 /* XXX - use a default bootdev of 0. Is this ok??? */
269 bootdevnr = 0;
270
265 switch(rootdev->d_type) {
266 case DEVT_DISK:
267 /* pass in the BIOS device number of the current disk */
268 bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit);
269 bootdevnr = bd_getdev(rootdev);
270 if (bootdevnr != -1)
271 break;
272 printf("root device %s invalid\n", i386_fmtdev(rootdev));

--- 65 unchanged lines hidden ---
271 switch(rootdev->d_type) {
272 case DEVT_DISK:
273 /* pass in the BIOS device number of the current disk */
274 bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit);
275 bootdevnr = bd_getdev(rootdev);
276 if (bootdevnr != -1)
277 break;
278 printf("root device %s invalid\n", i386_fmtdev(rootdev));

--- 65 unchanged lines hidden ---