FreeBSD/sys/boot/pc98/loader/main.c
/*
 * Set the 'current device' by (if possible) recovering the boot device as 
 * supplied by the initial bootstrap.
 *
 * XXX should be extended for netbooting.
 */
Set the 'current device' by (if possible) recovering the boot device as
supplied by the initial bootstrap.

XXX should be extended for netbooting.
Set the ' current device ' by ( if possible ) recovering the boot device as supplied by the initial bootstrap . XXX should be extended for netbooting .
static void
extract_currdev(void)
{
    struct i386_devdesc		new_currdev;
    int				major;
    int				biosdev = -1;
    new_currdev.d_dev = &biosdisk;
    if (kargs->bootinfo == 0) {
        if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
	    new_currdev.d_dev = &bioscd;
	    new_currdev.d_unit = bc_bios2unit(initial_bootdev);
	} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
	    new_currdev.d_dev = &pxedisk;
	    new_currdev.d_unit = 0;
	} else {
	    new_currdev.d_kind.biosdisk.slice = -1;
	    new_currdev.d_kind.biosdisk.partition = 0;
	    biosdev = -1;
	}
    } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
	new_currdev.d_kind.biosdisk.slice = -1;
	new_currdev.d_kind.biosdisk.partition = 0;
	biosdev = -1;
    } else {
	new_currdev.d_kind.biosdisk.slice = B_SLICE(initial_bootdev) - 1;
	new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
	biosdev = initial_bootinfo->bi_bios_dev;
	major = B_TYPE(initial_bootdev);
	if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) {	
	    if (B_TYPE(initial_bootdev) == 6)
		biosdev = 0x30 + B_UNIT(initial_bootdev);
	    else
		biosdev = (major << 3) + 0x80 + B_UNIT(initial_bootdev);
	}
    }
    new_currdev.d_type = new_currdev.d_dev->dv_type;
    if ((new_currdev.d_type == biosdisk.dv_type) &&
	((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) {
	printf("Can't work out which disk we are booting from.\n"
	       "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev);
	new_currdev.d_unit = 0;
    }
    env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
	       i386_setcurrdev, env_nounset);
    env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset,
	       env_nounset);
}
static void extract_currdev ( void ) { struct i386_devdesc new_currdev ; int major ; int biosdev = -1 ; new_currdev . d_dev = & biosdisk ; if ( kargs -> bootinfo == 0 ) { if ( ( kargs -> bootflags & KARGS_FLAGS_CD ) != 0 ) { new_currdev . d_dev = & bioscd ; new_currdev . d_unit = bc_bios2unit ( initial_bootdev ) ; } else if ( ( kargs -> bootflags & KARGS_FLAGS_PXE ) != 0 ) { new_currdev . d_dev = & pxedisk ; new_currdev . d_unit = 0 ; } else { new_currdev . d_kind . biosdisk . slice = -1 ; new_currdev . d_kind . biosdisk . partition = 0 ; biosdev = -1 ; } } else if ( ( initial_bootdev & B_MAGICMASK ) != B_DEVMAGIC ) { new_currdev . d_kind . biosdisk . slice = -1 ; new_currdev . d_kind . biosdisk . partition = 0 ; biosdev = -1 ; } else { new_currdev . d_kind . biosdisk . slice = B_SLICE ( initial_bootdev ) - 1 ; new_currdev . d_kind . biosdisk . partition = B_PARTITION ( initial_bootdev ) ; biosdev = initial_bootinfo -> bi_bios_dev ; major = B_TYPE ( initial_bootdev ) ; if ( ( biosdev == 0 ) && ( B_TYPE ( initial_bootdev ) != 2 ) ) { if ( B_TYPE ( initial_bootdev ) == 6 ) biosdev = 0x30 + B_UNIT ( initial_bootdev ) ; else biosdev = ( major << 3 ) + 0x80 + B_UNIT ( initial_bootdev ) ; } } new_currdev . d_type = new_currdev . d_dev -> dv_type ; if ( ( new_currdev . d_type == biosdisk . dv_type ) && ( ( new_currdev . d_unit = bd_bios2unit ( biosdev ) ) == -1 ) ) { printf ( " \n " " \n " , biosdev ) ; new_currdev . d_unit = 0 ; } env_setenv ( " " , EV_VOLATILE , i386_fmtdev ( & new_currdev ) , i386_setcurrdev , env_nounset ) ; env_setenv ( " " , EV_VOLATILE , i386_fmtdev ( & new_currdev ) , env_noset , env_nounset ) ; }
Set the 'current device' by (if possible) recovering the boot device as
 supplied by the initial bootstrap.
Set the ' current device ' by ( if possible ) recovering the boot device as supplied by the initial bootstrap .
/* Assume we are booting from a BIOS disk by default */ /* new-style boot loaders such as pxeldr and cdldr */ /* we are booting from a CD with cdboot */ /* we are booting from pxeldr */ /* we don't know what our boot device is */ /* The passed-in boot device is bad */ /*
	 * If we are booted by an old bootstrap, we have to guess at the BIOS
	 * unit number.  We will lose if there is more than one disk type
	 * and we are not booting from the lowest-numbered disk type 
	 * (ie. SCSI when IDE also exists).
	 */ /* biosdev doesn't match major */ /*
     * If we are booting off of a BIOS disk and we didn't succeed in determining
     * which one we booted off of, just use disk0: as a reasonable default.
     */