summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2005-10-16 20:22:36 +0000
committersobomax <sobomax@FreeBSD.org>2005-10-16 20:22:36 +0000
commit643ec6468f745d42570f07a6873d4eeffe51baa6 (patch)
tree739071c9abba5efdfefb3574d6f2d5db3f683547 /sys
parentf2877535cf22142c43b851590ae78b244608c551 (diff)
downloadFreeBSD-src-643ec6468f745d42570f07a6873d4eeffe51baa6.zip
FreeBSD-src-643ec6468f745d42570f07a6873d4eeffe51baa6.tar.gz
Re-implement rev.1.76 with respect to the code size.
Diffstat (limited to 'sys')
-rw-r--r--sys/boot/i386/boot2/boot2.c37
-rw-r--r--sys/boot/i386/gptboot/gptboot.c37
2 files changed, 44 insertions, 30 deletions
diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c
index 2027a85..814c14b 100644
--- a/sys/boot/i386/boot2/boot2.c
+++ b/sys/boot/i386/boot2/boot2.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
/* 0x12 is reserved for boot programs. */
/* 0x13 is reserved for boot programs. */
#define RBX_PAUSE 0x14 /* -p */
+#define RBX_QUIET 0x15 /* -q */
#define RBX_NOINTR 0x1c /* -n */
/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
#define RBX_DUAL 0x1d /* -D */
@@ -73,7 +74,7 @@ __FBSDID("$FreeBSD$");
#define PATH_KERNEL "/boot/kernel/kernel"
#define ARGS 0x900
-#define NOPT 11
+#define NOPT 12
#define NDEV 3
#define MEM_BASE 0x12
#define MEM_EXT 0x15
@@ -88,9 +89,11 @@ __FBSDID("$FreeBSD$");
#define TYPE_MAXHARD TYPE_DA
#define TYPE_FD 2
+#define OPT_CHECK(opt) ((opts >> (opt)) & 1)
+
extern uint32_t _end;
-static const char optstr[NOPT] = "DhaCgmnprsv"; /* Also 'P', 'S' */
+static const char optstr[NOPT] = "DhaCgmnpqrsv"; /* Also 'P', 'S' */
static const unsigned char flags[NOPT] = {
RBX_DUAL,
RBX_SERIAL,
@@ -100,6 +103,7 @@ static const unsigned char flags[NOPT] = {
RBX_MUTE,
RBX_NOINTR,
RBX_PAUSE,
+ RBX_QUIET,
RBX_DFLTROOT,
RBX_SINGLE,
RBX_VERBOSE
@@ -158,7 +162,7 @@ strcmp(const char *s1, const char *s2)
#include "ufsread.c"
-static int
+static inline int
xfsread(ino_t inode, void *buf, size_t nbyte)
{
if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
@@ -244,7 +248,8 @@ main(void)
if (*cmd) {
if (parse())
autoboot = 0;
- printf("%s: %s", PATH_CONFIG, cmd);
+ if (!OPT_CHECK(RBX_QUIET))
+ printf("%s: %s", PATH_CONFIG, cmd);
/* Do not process this command twice */
*cmd = 0;
}
@@ -265,16 +270,17 @@ main(void)
/* Present the user with the boot2 prompt. */
for (;;) {
- printf("\nFreeBSD/i386 boot\n"
- "Default: %u:%s(%u,%c)%s\n"
- "boot: ",
- dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
- 'a' + dsk.part, kname);
+ if (!autoboot || !OPT_CHECK(RBX_QUIET))
+ printf("\nFreeBSD/i386 boot\n"
+ "Default: %u:%s(%u,%c)%s\n"
+ "boot: ",
+ dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
+ 'a' + dsk.part, kname);
if (ioctrl & IO_SERIAL)
sio_flush();
if (!autoboot || keyhit(5*SECOND))
getstr();
- else
+ else if (!autoboot || !OPT_CHECK(RBX_QUIET))
putchar('\n');
autoboot = 0;
if (parse())
@@ -297,8 +303,8 @@ load(void)
struct exec ex;
Elf32_Ehdr eh;
} hdr;
- Elf32_Phdr ep[2];
- Elf32_Shdr es[2];
+ static Elf32_Phdr ep[2];
+ static Elf32_Shdr es[2];
caddr_t p;
ino_t ino;
uint32_t addr, x;
@@ -596,7 +602,8 @@ drvread(void *buf, unsigned lba, unsigned nblk)
{
static unsigned c = 0x2d5c7c2f;
- printf("%c\b", c = c << 8 | c >> 24);
+ if (!OPT_CHECK(RBX_QUIET))
+ printf("%c\b", c = c << 8 | c >> 24);
v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS;
v86.addr = XREADORG; /* call to xread in boot1 */
v86.es = VTOPSEG(buf);
@@ -618,7 +625,7 @@ keyhit(unsigned ticks)
{
uint32_t t0, t1;
- if (opts & 1 << RBX_NOINTR)
+ if (OPT_CHECK(RBX_NOINTR))
return 0;
t0 = 0;
for (;;) {
@@ -645,7 +652,7 @@ xputc(int c)
static int
xgetc(int fn)
{
- if (opts & 1 << RBX_NOINTR)
+ if (OPT_CHECK(RBX_NOINTR))
return 0;
for (;;) {
if (ioctrl & IO_KEYBOARD && getc(1))
diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c
index 2027a85..814c14b 100644
--- a/sys/boot/i386/gptboot/gptboot.c
+++ b/sys/boot/i386/gptboot/gptboot.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
/* 0x12 is reserved for boot programs. */
/* 0x13 is reserved for boot programs. */
#define RBX_PAUSE 0x14 /* -p */
+#define RBX_QUIET 0x15 /* -q */
#define RBX_NOINTR 0x1c /* -n */
/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
#define RBX_DUAL 0x1d /* -D */
@@ -73,7 +74,7 @@ __FBSDID("$FreeBSD$");
#define PATH_KERNEL "/boot/kernel/kernel"
#define ARGS 0x900
-#define NOPT 11
+#define NOPT 12
#define NDEV 3
#define MEM_BASE 0x12
#define MEM_EXT 0x15
@@ -88,9 +89,11 @@ __FBSDID("$FreeBSD$");
#define TYPE_MAXHARD TYPE_DA
#define TYPE_FD 2
+#define OPT_CHECK(opt) ((opts >> (opt)) & 1)
+
extern uint32_t _end;
-static const char optstr[NOPT] = "DhaCgmnprsv"; /* Also 'P', 'S' */
+static const char optstr[NOPT] = "DhaCgmnpqrsv"; /* Also 'P', 'S' */
static const unsigned char flags[NOPT] = {
RBX_DUAL,
RBX_SERIAL,
@@ -100,6 +103,7 @@ static const unsigned char flags[NOPT] = {
RBX_MUTE,
RBX_NOINTR,
RBX_PAUSE,
+ RBX_QUIET,
RBX_DFLTROOT,
RBX_SINGLE,
RBX_VERBOSE
@@ -158,7 +162,7 @@ strcmp(const char *s1, const char *s2)
#include "ufsread.c"
-static int
+static inline int
xfsread(ino_t inode, void *buf, size_t nbyte)
{
if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
@@ -244,7 +248,8 @@ main(void)
if (*cmd) {
if (parse())
autoboot = 0;
- printf("%s: %s", PATH_CONFIG, cmd);
+ if (!OPT_CHECK(RBX_QUIET))
+ printf("%s: %s", PATH_CONFIG, cmd);
/* Do not process this command twice */
*cmd = 0;
}
@@ -265,16 +270,17 @@ main(void)
/* Present the user with the boot2 prompt. */
for (;;) {
- printf("\nFreeBSD/i386 boot\n"
- "Default: %u:%s(%u,%c)%s\n"
- "boot: ",
- dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
- 'a' + dsk.part, kname);
+ if (!autoboot || !OPT_CHECK(RBX_QUIET))
+ printf("\nFreeBSD/i386 boot\n"
+ "Default: %u:%s(%u,%c)%s\n"
+ "boot: ",
+ dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
+ 'a' + dsk.part, kname);
if (ioctrl & IO_SERIAL)
sio_flush();
if (!autoboot || keyhit(5*SECOND))
getstr();
- else
+ else if (!autoboot || !OPT_CHECK(RBX_QUIET))
putchar('\n');
autoboot = 0;
if (parse())
@@ -297,8 +303,8 @@ load(void)
struct exec ex;
Elf32_Ehdr eh;
} hdr;
- Elf32_Phdr ep[2];
- Elf32_Shdr es[2];
+ static Elf32_Phdr ep[2];
+ static Elf32_Shdr es[2];
caddr_t p;
ino_t ino;
uint32_t addr, x;
@@ -596,7 +602,8 @@ drvread(void *buf, unsigned lba, unsigned nblk)
{
static unsigned c = 0x2d5c7c2f;
- printf("%c\b", c = c << 8 | c >> 24);
+ if (!OPT_CHECK(RBX_QUIET))
+ printf("%c\b", c = c << 8 | c >> 24);
v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS;
v86.addr = XREADORG; /* call to xread in boot1 */
v86.es = VTOPSEG(buf);
@@ -618,7 +625,7 @@ keyhit(unsigned ticks)
{
uint32_t t0, t1;
- if (opts & 1 << RBX_NOINTR)
+ if (OPT_CHECK(RBX_NOINTR))
return 0;
t0 = 0;
for (;;) {
@@ -645,7 +652,7 @@ xputc(int c)
static int
xgetc(int fn)
{
- if (opts & 1 << RBX_NOINTR)
+ if (OPT_CHECK(RBX_NOINTR))
return 0;
for (;;) {
if (ioctrl & IO_KEYBOARD && getc(1))
OpenPOWER on IntegriCloud