diff --git a/sys/i386/boot/biosboot/Makefile b/sys/i386/boot/biosboot/Makefile index 75a42284f54..6eb76a6afa2 100644 --- a/sys/i386/boot/biosboot/Makefile +++ b/sys/i386/boot/biosboot/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.41 1996/07/09 02:28:15 julian Exp $ +# $Id: Makefile,v 1.42 1996/07/12 05:17:36 bde Exp $ # PROG= boot @@ -75,7 +75,7 @@ boot1: boot.nohdr boot2: boot.nohdr dd if=boot.nohdr of=boot2 bs=512 skip=1 - @dd if=boot2 skip=14 of=sizetest 2> /dev/null + @dd if=boot2 skip=15 of=sizetest 2> /dev/null @if [ -s sizetest ] ; then \ echo "*** Boot2 is too BIG ***" ; exit 2 ; \ fi diff --git a/sys/i386/boot/biosboot/boot.c b/sys/i386/boot/biosboot/boot.c index 59459135016..1f2e870c84a 100644 --- a/sys/i386/boot/biosboot/boot.c +++ b/sys/i386/boot/biosboot/boot.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, [92/04/03 16:51:14 rvb] - * $Id: boot.c,v 1.54 1996/08/27 19:45:37 pst Exp $ + * $Id: boot.c,v 1.55 1996/08/28 18:29:51 ache Exp $ */ @@ -62,33 +62,36 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NAMEBUF_LEN (8*1024) #ifdef NAMEBLOCK -char *dflt_name; +char *dflt_name ; +/*char *dflt_name = (char *)0x0000ffb0; */ /* force it to not be in the BSS */ #endif char namebuf[NAMEBUF_LEN]; struct exec head; struct bootinfo bootinfo; int loadflags; -static void getbootdev(char *ptr, int *howto); static void loadprog(void); /* NORETURN */ void boot(int drive) { + char *ptr; + int howto; + char c; int ret; #ifdef PROBE_KEYBOARD if (probe_keyboard()) { init_serial(); - loadflags |= RB_SERIAL; + loadflags = RB_SERIAL; printf("\nNo keyboard found."); } #endif #ifdef FORCE_COMCONSOLE init_serial(); - loadflags |= RB_SERIAL; + loadflags = RB_SERIAL; printf("\nSerial console forced."); #endif @@ -131,17 +134,15 @@ boot(int drive) } #ifdef NAMEBLOCK /* - * XXX - * DAMN! I don't understand why this is not being set - * by the code in boot2.S + * this is set by the code in boot2.S */ - dflt_name= (char *)0x0000ffb0; if( (*dflt_name++ == 'D') && (*dflt_name++ == 'N')) { - name = dflt_name; + strcpy(namebuf,dflt_name); } else #endif /*NAMEBLOCK*/ loadstart: - name = dflname; /* re-initialize in case of loop */ + strcpy(namebuf,dflname);/* re-initialize in case of loop */ + name = dflname; /* XXX check if needed */ /* print this all each time.. (saves space to do so) */ /* If we have looped, use the previous entries as defaults */ printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n" @@ -151,17 +152,85 @@ boot(int drive) ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem, dosdev & 0x7f, devs[maj], unit, name); - loadflags &= RB_SERIAL; /* clear all, but leave serial console */ - getbootdev(namebuf, &loadflags); + /* + * Be paranoid and make doubly sure that the input buffer is empty. + */ + if(howto = (loadflags &= RB_SERIAL)) + init_serial(); /* clear all, but leave serial console */ + + if (!gets(namebuf)) { + putchar('\n'); + } + ptr = namebuf; + /* + * now parse out the boot options from what was given to us + * (or was read from the default string) + */ + while ((c = *ptr) != '\0') { + /* + * pass any leading (or inter-arg) spaces + */ + if (c == ' ') { + ptr++; + continue; + } + /* + * If it's an arg, take as many letters as we can + */ + if (c == '-') { + while ((c = *++ptr) != '\0') { + if (c == ' ') + break; + if (c == 'C') + howto |= RB_CDROM; + if (c == 'a') + howto |= RB_ASKNAME; + if (c == 'b') + howto |= RB_HALT; + if (c == 'c') + howto |= RB_CONFIG; + if (c == 'd') + howto |= RB_KDB; + if (c == 'h') { + howto ^= RB_SERIAL; + if (howto & RB_SERIAL) + init_serial(); + } + if (c == 'g') + howto |= RB_GDB; + if (c == 'r') + howto |= RB_DFLTROOT; + if (c == 's') + howto |= RB_SINGLE; + if (c == 'v') + howto |= RB_VERBOSE; + } + continue; + } + /* + * we have struck something that's not an arg, + * nor a space. + * break it off into a separate string.. "name" + * The default string will at least hit this.. + */ + name = ptr; + while (*++ptr != '\0') { + if (*ptr == ' ') { + *ptr++ = '\0'; + break; + } + } + } + loadflags = howto; + /* + * Now use "name" to try open the device and file for reading + */ ret = openrd(); if (ret != 0) { if (ret > 0) printf("Can't find %s\n", name); goto loadstart; } -/* if (inode.i_mode&IEXEC) - loadflags |= RB_KDB; -*/ loadprog(); goto loadstart; } @@ -294,61 +363,3 @@ loadprog(void) (int)&bootinfo + ouraddr); } -void -getbootdev(char *ptr, int *howto) -{ - char c; - - /* - * Be paranoid and make doubly sure that the input buffer is empty. - */ - if (*howto & RB_SERIAL) - init_serial(); - - if (!gets(ptr)) { - putchar('\n'); - return; - } - while ((c = *ptr) != '\0') { -nextarg: - while (c == ' ') - c = *++ptr; - if (c == '-') - while ((c = *++ptr) != '\0') { - if (c == ' ') - goto nextarg; - if (c == 'C') - *howto |= RB_CDROM; - if (c == 'a') - *howto |= RB_ASKNAME; - if (c == 'b') - *howto |= RB_HALT; - if (c == 'c') - *howto |= RB_CONFIG; - if (c == 'd') - *howto |= RB_KDB; - if (c == 'h') { - *howto ^= RB_SERIAL; - if (*howto & RB_SERIAL) - init_serial(); - } - if (c == 'g') - *howto |= RB_GDB; - if (c == 'r') - *howto |= RB_DFLTROOT; - if (c == 's') - *howto |= RB_SINGLE; - if (c == 'v') - *howto |= RB_VERBOSE; - } - if (c == '\0') - return; - name = ptr; - while (*++ptr != '\0') { - if (*ptr == ' ') { - *ptr++ = '\0'; - break; - } - } - } -} diff --git a/sys/i386/boot/biosboot/boot2.S b/sys/i386/boot/biosboot/boot2.S index aa37e7d2c0a..12a3d1afc34 100644 --- a/sys/i386/boot/biosboot/boot2.S +++ b/sys/i386/boot/biosboot/boot2.S @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:26 rpd - * $Id: boot2.S,v 1.7 1996/07/05 19:55:04 julian Exp $ + * $Id: boot2.S,v 1.8 1996/07/12 05:25:46 bde Exp $ */ #include "asm.h" @@ -58,11 +58,6 @@ ENTRY(boot2) mov %ax, %es data32 shll $4, %eax -#ifdef NAMEBLOCK - addr32 - data32 - movl %esp, EXT(dflt_name) -#endif /* fix up GDT entries for bootstrap */ #define FIXUP(gdt_index) \ @@ -170,6 +165,10 @@ ENTRY(boot2) rep stosb +#ifdef NAMEBLOCK + movl %esp, EXT(dflt_name) +#endif + movzbl %dl, %edx /* discard head (%dh) and random high bits */ pushl %edx call EXT(boot)