Index: src/sys/boot/i386/boot0/Makefile =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/boot0/Makefile,v retrieving revision 1.32 diff -u -r1.32 Makefile --- src/sys/boot/i386/boot0/Makefile 25 Apr 2005 17:41:35 -0000 1.32 +++ src/sys/boot/i386/boot0/Makefile 1 Sep 2005 17:12:16 -0000 @@ -45,6 +45,8 @@ BOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3" .elif ${BOOT_COMCONSOLE_SPEED} == 110 BOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3" +.elif ${BOOT_COMCONSOLE_SPEED} == 0 +BOOT_BOOT0_COMCONSOLE_SPEED= 0 .else BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3" .endif Index: src/sys/boot/i386/boot2/Makefile =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/boot2/Makefile,v retrieving revision 1.59 diff -u -r1.59 Makefile --- src/sys/boot/i386/boot2/Makefile 15 Jul 2005 12:22:14 -0000 1.59 +++ src/sys/boot/i386/boot2/Makefile 1 Sep 2005 17:12:16 -0000 @@ -23,7 +23,6 @@ CFLAGS= -Os \ -fno-guess-branch-probability \ -fomit-frame-pointer \ - -fno-unit-at-a-time \ -mno-align-long-strings \ -mrtd \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ Index: src/sys/boot/i386/boot2/boot2.c =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/boot2/boot2.c,v retrieving revision 1.74 diff -u -r1.74 boot2.c --- src/sys/boot/i386/boot2/boot2.c 18 Aug 2005 00:42:45 -0000 1.74 +++ src/sys/boot/i386/boot2/boot2.c 1 Sep 2005 17:12:16 -0000 @@ -63,6 +63,7 @@ #define RBX_NOINTR 0x1c /* -n */ /* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */ #define RBX_DUAL 0x1d /* -D */ +/* 0x1e is RBX_PROBEKBD (-P). No longer needed here. */ /* 0x1f is reserved for log2(RB_BOOTINFO). */ /* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */ @@ -73,7 +74,7 @@ #define PATH_KERNEL "/boot/kernel/kernel" #define ARGS 0x900 -#define NOPT 12 +#define NOPT 11 #define NDEV 3 #define MEM_BASE 0x12 #define MEM_EXT 0x15 @@ -90,13 +91,26 @@ extern uint32_t _end; -static const char optstr[NOPT] = "DhaCgmnprsv"; /* Also 'P', 'S' */ +static const char optstr[NOPT] = { + 'a', /* RBX_ASKNAME */ + 'C', /* RBX_CDROM */ + 'D', /* RBX_DUAL */ + 'g', /* RBX_GDB */ + 'h', /* RBX_SERIAL */ + 'm', /* RBX_MUTE */ + 'n', /* RBX_NOINTR */ + 'p', /* RBX_PAUSE */ + 'r', /* RBX_DFLTROOT */ + 's', /* RBX_SINGLE */ + 'v' /* RBX_VERBOSE */ +}; + static const unsigned char flags[NOPT] = { - RBX_DUAL, - RBX_SERIAL, RBX_ASKNAME, RBX_CDROM, + RBX_DUAL, RBX_GDB, + RBX_SERIAL, RBX_MUTE, RBX_NOINTR, RBX_PAUSE, @@ -138,8 +152,8 @@ static int xgetc(int); static int getc(int); -static void memcpy(void *, const void *, int); -static void +void memcpy(void *, const void *, int); +void memcpy(void *dst, const void *src, int len) { const char *s = src; @@ -388,22 +402,21 @@ static int parse() { - char *arg = cmd; - char *ep, *p, *q; + char *arg; + char *p, *q; const char *cp; - unsigned int drv; - int c, i, j; + unsigned drv; + int i, j; - while ((c = *arg++)) { - if (c == ' ' || c == '\t' || c == '\n') + for (arg = cmd; *arg; arg++) { + if (*arg == ' ' || *arg == '\t' || *arg == '\n') continue; for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); - ep = p; if (*p) - *p++ = 0; - if (c == '-') { - while ((c = *arg++)) { - if (c == 'P') { + *p = '\0'; + if (*arg == '-') { + for (q = arg + 1; *q; q++) { + if (*q == 'P') { if (*(uint8_t *)PTOV(0x496) & 0x10) { cp = "yes"; } else { @@ -411,33 +424,42 @@ cp = "no"; } printf("Keyboard: %s\n", cp); - continue; - } else if (c == 'S') { - j = 0; - while ((unsigned int)(i = *arg++ - '0') <= 9) - j = j * 10 + i; - if (j > 0 && i == -'0') { + } else if (*q == 'S') { + for (i = 1, j = 0; q[i] >= '0' && q[i] <= '9'; i++) + j = j * 10 + q[i] - '0'; +#if defined(UFS1_ONLY) || defined(UFS2_ONLY) + switch(i) { + case 0: /* do not change speed */ + case 110: case 150: case 300: case 1200: + case 2400: case 4800: case 9600: case 19200: + case 38400: case 57600: case 115200: comspeed = j; break; + default: /* invalid speed */ + return -1; } - /* Fall through to error below ('S' not in optstr[]). */ +#else + comspeed = j; +#endif + q += i - 1; + } else { + for (i = 0; *q != optstr[i]; i++) + if (i == NOPT - 1) + return -1; + opts ^= 1 << flags[i]; } - for (i = 0; c != optstr[i]; i++) - if (i == NOPT - 1) - return -1; - opts ^= 1 << flags[i]; } ioctrl = opts & 1 << RBX_DUAL ? (IO_SERIAL|IO_KEYBOARD) : opts & 1 << RBX_SERIAL ? IO_SERIAL : IO_KEYBOARD; - if (ioctrl & IO_SERIAL) - sio_init(115200 / comspeed); + if (comspeed && (ioctrl & IO_SERIAL)) + sio_init(115200 / comspeed); } else { - for (q = arg--; *q && *q != '('; q++); + for (q = arg; *q && *q != '('; q++); if (*q) { drv = -1; if (arg[1] == ':') { drv = *arg - '0'; - if (drv > 9) + if (drv < 0 || drv > 9) return (-1); arg += 2; } @@ -447,32 +469,31 @@ arg[1] != dev_nm[i][1]; i++) if (i == NDEV - 1) return -1; - dsk.type = i; arg += 3; dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) + if (arg[1] != ',' || dsk.unit < 0 || dsk.unit > 9) return -1; arg += 2; dsk.slice = WHOLE_DISK_SLICE; if (arg[1] == ',') { dsk.slice = *arg - '0' + 1; - if (dsk.slice > NDOSPART) + if (dsk.slice < 1 || dsk.slice > NDOSPART) return -1; arg += 2; } if (arg[1] != ')') return -1; dsk.part = *arg - 'a'; - if (dsk.part > 7) + if (dsk.part < 0 || dsk.part > 7) return (-1); arg += 2; if (drv == -1) drv = dsk.unit; - dsk.drive = (dsk.type <= TYPE_MAXHARD - ? DRV_HARD : 0) + drv; + dsk.drive = (i <= TYPE_MAXHARD ? DRV_HARD : 0) + drv; + dsk.type = i; dsk_meta = 0; } - if ((i = ep - arg)) { + if ((i = p - arg)) { if ((size_t)i >= sizeof(kname)) return -1; memcpy(kname, arg, i + 1); Index: src/sys/boot/i386/libi386/comconsole.c =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/libi386/comconsole.c,v retrieving revision 1.11 diff -u -r1.11 comconsole.c --- src/sys/boot/i386/libi386/comconsole.c 18 Aug 2005 01:39:43 -0000 1.11 +++ src/sys/boot/i386/libi386/comconsole.c 1 Sep 2005 17:12:16 -0000 @@ -96,6 +96,8 @@ if (speed > 0) comc_curspeed = speed; } + if (comc_curspeed == 0) + comc_curspeed = comc_getspeed(); sprintf(speedbuf, "%d", comc_curspeed); unsetenv("comconsole_speed"); @@ -145,7 +147,7 @@ { int speed; - if (value == NULL || (speed = comc_parsespeed(value)) <= 0) { + if (value == NULL || (speed = comc_parsespeed(value)) < 0) { printf("Invalid speed\n"); return (CMD_ERROR); } @@ -162,6 +164,8 @@ comc_setup(int speed) { + if (speed == 0) + return; comc_curspeed = speed; outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT); @@ -182,7 +186,7 @@ int speed; speed = strtol(speedstr, &p, 0); - if (p == speedstr || *p != '\0' || speed <= 0) + if (p == speedstr || *p != '\0' || speed < 0) return (-1); return (speed);