Re-implement rev.1.76 with respect to the code size.

This commit is contained in:
Maxim Sobolev 2005-10-16 20:22:36 +00:00
parent 6267ee870d
commit a9c76d92d2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151382
2 changed files with 44 additions and 30 deletions

View file

@ -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))

View file

@ -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))