Backout previous commit - for some reason it overflows space constrains on
amd64. Better version will follow.
This commit is contained in:
parent
8b9ed8abc3
commit
f2877535cf
@ -60,22 +60,20 @@ __FBSDID("$FreeBSD$");
|
||||
/* 0x12 is reserved for boot programs. */
|
||||
/* 0x13 is reserved for boot programs. */
|
||||
#define RBX_PAUSE 0x14 /* -p */
|
||||
#define RBX_NOINTR 0x1c /* -n */
|
||||
/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
|
||||
#define RBX_DUAL 0x1d /* -D */
|
||||
/* 0x1f is reserved for log2(RB_BOOTINFO). */
|
||||
/* group of internal options below */
|
||||
#define RBX_NOINTR 0x20 /* -n */
|
||||
#define RBX_QUIET 0x21 /* -q */
|
||||
|
||||
/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
|
||||
#define RBX_MASK 0xffffffff
|
||||
#define RBX_MASK 0x2011ffff
|
||||
|
||||
#define PATH_CONFIG "/boot.config"
|
||||
#define PATH_BOOT3 "/boot/loader"
|
||||
#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,11 +88,9 @@ __FBSDID("$FreeBSD$");
|
||||
#define TYPE_MAXHARD TYPE_DA
|
||||
#define TYPE_FD 2
|
||||
|
||||
#define OPT_CHECK(opt) ((opts >> (opt)) & 0x1)
|
||||
|
||||
extern uint32_t _end;
|
||||
|
||||
static const char optstr[NOPT] = "DhaCgmnpqrsv"; /* Also 'P', 'S' */
|
||||
static const char optstr[NOPT] = "DhaCgmnprsv"; /* Also 'P', 'S' */
|
||||
static const unsigned char flags[NOPT] = {
|
||||
RBX_DUAL,
|
||||
RBX_SERIAL,
|
||||
@ -104,7 +100,6 @@ static const unsigned char flags[NOPT] = {
|
||||
RBX_MUTE,
|
||||
RBX_NOINTR,
|
||||
RBX_PAUSE,
|
||||
RBX_QUIET,
|
||||
RBX_DFLTROOT,
|
||||
RBX_SINGLE,
|
||||
RBX_VERBOSE
|
||||
@ -124,7 +119,7 @@ static struct dsk {
|
||||
} dsk;
|
||||
static char cmd[512];
|
||||
static char kname[1024];
|
||||
static uint64_t opts;
|
||||
static uint32_t opts;
|
||||
static int comspeed = SIOSPD;
|
||||
static struct bootinfo bootinfo;
|
||||
static uint8_t ioctrl = IO_KEYBOARD;
|
||||
@ -163,7 +158,7 @@ strcmp(const char *s1, const char *s2)
|
||||
|
||||
#include "ufsread.c"
|
||||
|
||||
static inline int
|
||||
static int
|
||||
xfsread(ino_t inode, void *buf, size_t nbyte)
|
||||
{
|
||||
if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
|
||||
@ -249,8 +244,7 @@ main(void)
|
||||
if (*cmd) {
|
||||
if (parse())
|
||||
autoboot = 0;
|
||||
if (!OPT_CHECK(RBX_QUIET))
|
||||
printf("%s: %s", PATH_CONFIG, cmd);
|
||||
printf("%s: %s", PATH_CONFIG, cmd);
|
||||
/* Do not process this command twice */
|
||||
*cmd = 0;
|
||||
}
|
||||
@ -271,17 +265,16 @@ main(void)
|
||||
/* Present the user with the boot2 prompt. */
|
||||
|
||||
for (;;) {
|
||||
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);
|
||||
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 if (!autoboot || !OPT_CHECK(RBX_QUIET))
|
||||
else
|
||||
putchar('\n');
|
||||
autoboot = 0;
|
||||
if (parse())
|
||||
@ -300,12 +293,12 @@ exit(int x)
|
||||
static void
|
||||
load(void)
|
||||
{
|
||||
static union {
|
||||
union {
|
||||
struct exec ex;
|
||||
Elf32_Ehdr eh;
|
||||
} hdr;
|
||||
static Elf32_Phdr ep[2];
|
||||
static Elf32_Shdr es[2];
|
||||
Elf32_Phdr ep[2];
|
||||
Elf32_Shdr es[2];
|
||||
caddr_t p;
|
||||
ino_t ino;
|
||||
uint32_t addr, x;
|
||||
@ -387,7 +380,7 @@ load(void)
|
||||
bootinfo.bi_esymtab = VTOP(p);
|
||||
bootinfo.bi_kernelname = VTOP(kname);
|
||||
bootinfo.bi_bios_dev = dsk.drive;
|
||||
__exec((caddr_t)addr, RB_BOOTINFO | (uint32_t)(opts & RBX_MASK),
|
||||
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
|
||||
MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
|
||||
0, 0, 0, VTOP(&bootinfo));
|
||||
}
|
||||
@ -414,7 +407,7 @@ parse()
|
||||
if (*(uint8_t *)PTOV(0x496) & 0x10) {
|
||||
cp = "yes";
|
||||
} else {
|
||||
opts |= (uint64_t)1 << RBX_DUAL | (uint64_t)1 << RBX_SERIAL;
|
||||
opts |= 1 << RBX_DUAL | 1 << RBX_SERIAL;
|
||||
cp = "no";
|
||||
}
|
||||
printf("Keyboard: %s\n", cp);
|
||||
@ -432,10 +425,10 @@ parse()
|
||||
for (i = 0; c != optstr[i]; i++)
|
||||
if (i == NOPT - 1)
|
||||
return -1;
|
||||
opts ^= (uint64_t)1 << flags[i];
|
||||
opts ^= 1 << flags[i];
|
||||
}
|
||||
ioctrl = opts & (uint64_t)1 << RBX_DUAL ? (IO_SERIAL|IO_KEYBOARD) :
|
||||
opts & (uint64_t)1 << RBX_SERIAL ? IO_SERIAL : IO_KEYBOARD;
|
||||
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);
|
||||
} else {
|
||||
@ -603,8 +596,7 @@ drvread(void *buf, unsigned lba, unsigned nblk)
|
||||
{
|
||||
static unsigned c = 0x2d5c7c2f;
|
||||
|
||||
if (!OPT_CHECK(RBX_QUIET))
|
||||
printf("%c\b", c = c << 8 | c >> 24);
|
||||
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);
|
||||
@ -626,7 +618,7 @@ keyhit(unsigned ticks)
|
||||
{
|
||||
uint32_t t0, t1;
|
||||
|
||||
if (OPT_CHECK(RBX_NOINTR))
|
||||
if (opts & 1 << RBX_NOINTR)
|
||||
return 0;
|
||||
t0 = 0;
|
||||
for (;;) {
|
||||
@ -653,7 +645,7 @@ xputc(int c)
|
||||
static int
|
||||
xgetc(int fn)
|
||||
{
|
||||
if (OPT_CHECK(RBX_NOINTR))
|
||||
if (opts & 1 << RBX_NOINTR)
|
||||
return 0;
|
||||
for (;;) {
|
||||
if (ioctrl & IO_KEYBOARD && getc(1))
|
||||
|
@ -60,22 +60,20 @@ __FBSDID("$FreeBSD$");
|
||||
/* 0x12 is reserved for boot programs. */
|
||||
/* 0x13 is reserved for boot programs. */
|
||||
#define RBX_PAUSE 0x14 /* -p */
|
||||
#define RBX_NOINTR 0x1c /* -n */
|
||||
/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
|
||||
#define RBX_DUAL 0x1d /* -D */
|
||||
/* 0x1f is reserved for log2(RB_BOOTINFO). */
|
||||
/* group of internal options below */
|
||||
#define RBX_NOINTR 0x20 /* -n */
|
||||
#define RBX_QUIET 0x21 /* -q */
|
||||
|
||||
/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
|
||||
#define RBX_MASK 0xffffffff
|
||||
#define RBX_MASK 0x2011ffff
|
||||
|
||||
#define PATH_CONFIG "/boot.config"
|
||||
#define PATH_BOOT3 "/boot/loader"
|
||||
#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,11 +88,9 @@ __FBSDID("$FreeBSD$");
|
||||
#define TYPE_MAXHARD TYPE_DA
|
||||
#define TYPE_FD 2
|
||||
|
||||
#define OPT_CHECK(opt) ((opts >> (opt)) & 0x1)
|
||||
|
||||
extern uint32_t _end;
|
||||
|
||||
static const char optstr[NOPT] = "DhaCgmnpqrsv"; /* Also 'P', 'S' */
|
||||
static const char optstr[NOPT] = "DhaCgmnprsv"; /* Also 'P', 'S' */
|
||||
static const unsigned char flags[NOPT] = {
|
||||
RBX_DUAL,
|
||||
RBX_SERIAL,
|
||||
@ -104,7 +100,6 @@ static const unsigned char flags[NOPT] = {
|
||||
RBX_MUTE,
|
||||
RBX_NOINTR,
|
||||
RBX_PAUSE,
|
||||
RBX_QUIET,
|
||||
RBX_DFLTROOT,
|
||||
RBX_SINGLE,
|
||||
RBX_VERBOSE
|
||||
@ -124,7 +119,7 @@ static struct dsk {
|
||||
} dsk;
|
||||
static char cmd[512];
|
||||
static char kname[1024];
|
||||
static uint64_t opts;
|
||||
static uint32_t opts;
|
||||
static int comspeed = SIOSPD;
|
||||
static struct bootinfo bootinfo;
|
||||
static uint8_t ioctrl = IO_KEYBOARD;
|
||||
@ -163,7 +158,7 @@ strcmp(const char *s1, const char *s2)
|
||||
|
||||
#include "ufsread.c"
|
||||
|
||||
static inline int
|
||||
static int
|
||||
xfsread(ino_t inode, void *buf, size_t nbyte)
|
||||
{
|
||||
if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
|
||||
@ -249,8 +244,7 @@ main(void)
|
||||
if (*cmd) {
|
||||
if (parse())
|
||||
autoboot = 0;
|
||||
if (!OPT_CHECK(RBX_QUIET))
|
||||
printf("%s: %s", PATH_CONFIG, cmd);
|
||||
printf("%s: %s", PATH_CONFIG, cmd);
|
||||
/* Do not process this command twice */
|
||||
*cmd = 0;
|
||||
}
|
||||
@ -271,17 +265,16 @@ main(void)
|
||||
/* Present the user with the boot2 prompt. */
|
||||
|
||||
for (;;) {
|
||||
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);
|
||||
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 if (!autoboot || !OPT_CHECK(RBX_QUIET))
|
||||
else
|
||||
putchar('\n');
|
||||
autoboot = 0;
|
||||
if (parse())
|
||||
@ -300,12 +293,12 @@ exit(int x)
|
||||
static void
|
||||
load(void)
|
||||
{
|
||||
static union {
|
||||
union {
|
||||
struct exec ex;
|
||||
Elf32_Ehdr eh;
|
||||
} hdr;
|
||||
static Elf32_Phdr ep[2];
|
||||
static Elf32_Shdr es[2];
|
||||
Elf32_Phdr ep[2];
|
||||
Elf32_Shdr es[2];
|
||||
caddr_t p;
|
||||
ino_t ino;
|
||||
uint32_t addr, x;
|
||||
@ -387,7 +380,7 @@ load(void)
|
||||
bootinfo.bi_esymtab = VTOP(p);
|
||||
bootinfo.bi_kernelname = VTOP(kname);
|
||||
bootinfo.bi_bios_dev = dsk.drive;
|
||||
__exec((caddr_t)addr, RB_BOOTINFO | (uint32_t)(opts & RBX_MASK),
|
||||
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
|
||||
MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
|
||||
0, 0, 0, VTOP(&bootinfo));
|
||||
}
|
||||
@ -414,7 +407,7 @@ parse()
|
||||
if (*(uint8_t *)PTOV(0x496) & 0x10) {
|
||||
cp = "yes";
|
||||
} else {
|
||||
opts |= (uint64_t)1 << RBX_DUAL | (uint64_t)1 << RBX_SERIAL;
|
||||
opts |= 1 << RBX_DUAL | 1 << RBX_SERIAL;
|
||||
cp = "no";
|
||||
}
|
||||
printf("Keyboard: %s\n", cp);
|
||||
@ -432,10 +425,10 @@ parse()
|
||||
for (i = 0; c != optstr[i]; i++)
|
||||
if (i == NOPT - 1)
|
||||
return -1;
|
||||
opts ^= (uint64_t)1 << flags[i];
|
||||
opts ^= 1 << flags[i];
|
||||
}
|
||||
ioctrl = opts & (uint64_t)1 << RBX_DUAL ? (IO_SERIAL|IO_KEYBOARD) :
|
||||
opts & (uint64_t)1 << RBX_SERIAL ? IO_SERIAL : IO_KEYBOARD;
|
||||
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);
|
||||
} else {
|
||||
@ -603,8 +596,7 @@ drvread(void *buf, unsigned lba, unsigned nblk)
|
||||
{
|
||||
static unsigned c = 0x2d5c7c2f;
|
||||
|
||||
if (!OPT_CHECK(RBX_QUIET))
|
||||
printf("%c\b", c = c << 8 | c >> 24);
|
||||
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);
|
||||
@ -626,7 +618,7 @@ keyhit(unsigned ticks)
|
||||
{
|
||||
uint32_t t0, t1;
|
||||
|
||||
if (OPT_CHECK(RBX_NOINTR))
|
||||
if (opts & 1 << RBX_NOINTR)
|
||||
return 0;
|
||||
t0 = 0;
|
||||
for (;;) {
|
||||
@ -653,7 +645,7 @@ xputc(int c)
|
||||
static int
|
||||
xgetc(int fn)
|
||||
{
|
||||
if (OPT_CHECK(RBX_NOINTR))
|
||||
if (opts & 1 << RBX_NOINTR)
|
||||
return 0;
|
||||
for (;;) {
|
||||
if (ioctrl & IO_KEYBOARD && getc(1))
|
||||
|
Loading…
Reference in New Issue
Block a user