Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/isoboot/isoboot.c
Show All 37 Lines | |||||
#include "lib.h" | #include "lib.h" | ||||
#include "rbx.h" | #include "rbx.h" | ||||
#include "drv.h" | #include "drv.h" | ||||
#include "cons.h" | #include "cons.h" | ||||
#include "gpt.h" | #include "gpt.h" | ||||
#include "paths.h" | #include "paths.h" | ||||
#define ARGS 0x900 | #define ARGS 0x900 | ||||
#define NOPT 14 | #define NOPT 15 | ||||
#define NDEV 3 | #define NDEV 3 | ||||
#define MEM_BASE 0x12 | #define MEM_BASE 0x12 | ||||
#define MEM_EXT 0x15 | #define MEM_EXT 0x15 | ||||
#define DRV_HARD 0x80 | #define DRV_HARD 0x80 | ||||
#define DRV_MASK 0x7f | #define DRV_MASK 0x7f | ||||
#define TYPE_AD 0 | #define TYPE_AD 0 | ||||
#define TYPE_DA 1 | #define TYPE_DA 1 | ||||
#define TYPE_MAXHARD TYPE_DA | #define TYPE_MAXHARD TYPE_DA | ||||
#define TYPE_FD 2 | #define TYPE_FD 2 | ||||
extern uint32_t _end; | extern uint32_t _end; | ||||
static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ | static const char optstr[NOPT] = "DhaCcdgmnpqRrsv"; /* Also 'P', 'S' */ | ||||
imp: It would be nice to abstract the 'small parsing routines' down into one copy rather than the 6… | |||||
Done Inline ActionsI'm not sure, that it should be done in this change. lev: I'm not sure, that it should be done in this change. | |||||
static const unsigned char flags[NOPT] = { | static const unsigned char flags[NOPT] = { | ||||
RBX_DUAL, | RBX_DUAL, | ||||
RBX_SERIAL, | RBX_SERIAL, | ||||
RBX_ASKNAME, | RBX_ASKNAME, | ||||
RBX_CDROM, | RBX_CDROM, | ||||
RBX_CONFIG, | RBX_CONFIG, | ||||
RBX_KDB, | RBX_KDB, | ||||
RBX_GDB, | RBX_GDB, | ||||
RBX_MUTE, | RBX_MUTE, | ||||
RBX_NOINTR, | RBX_NOINTR, | ||||
RBX_PAUSE, | RBX_PAUSE, | ||||
RBX_QUIET, | RBX_QUIET, | ||||
RBX_RTERM, | |||||
RBX_DFLTROOT, | RBX_DFLTROOT, | ||||
RBX_SINGLE, | RBX_SINGLE, | ||||
RBX_VERBOSE | RBX_VERBOSE | ||||
}; | }; | ||||
uint32_t opts; | uint32_t opts; | ||||
static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; | static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; | ||||
static const unsigned char dev_maj[NDEV] = {30, 4, 2}; | static const unsigned char dev_maj[NDEV] = {30, 4, 2}; | ||||
static struct dsk dsk; | static struct dsk dsk; | ||||
static char kname[1024]; | static char kname[1024]; | ||||
static int comspeed = SIOSPD; | static int comspeed = SIOSPD; | ||||
static const char resettermcmd[] = SIORST; | |||||
static struct bootinfo bootinfo; | static struct bootinfo bootinfo; | ||||
static vm_offset_t high_heap_base; | static vm_offset_t high_heap_base; | ||||
static uint32_t bios_basemem, bios_extmem, high_heap_size; | static uint32_t bios_basemem, bios_extmem, high_heap_size; | ||||
static struct bios_smap smap; | static struct bios_smap smap; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 373 Lines • ▼ Show 20 Lines | if (c == '-') { | ||||
for (i = 0; c != optstr[i]; i++) | for (i = 0; c != optstr[i]; i++) | ||||
if (i == NOPT - 1) | if (i == NOPT - 1) | ||||
return (-1); | return (-1); | ||||
opts ^= OPT_SET(flags[i]); | opts ^= OPT_SET(flags[i]); | ||||
} | } | ||||
ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : | ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : | ||||
OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; | OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; | ||||
if (ioctrl & IO_SERIAL) { | if (ioctrl & IO_SERIAL) { | ||||
if (sio_init(115200 / comspeed) != 0) | if (sio_init(115200 / comspeed) != 0) { | ||||
ioctrl &= ~IO_SERIAL; | ioctrl &= ~IO_SERIAL; | ||||
} else if (OPT_CHECK(RBX_RTERM)) { | |||||
for (i = 0; resettermcmd[i]; i++) | |||||
sio_putc(resettermcmd[i]); | |||||
sio_flush(); | |||||
} | |||||
} | } | ||||
} else { | } else { | ||||
for (q = arg--; *q && *q != '('; q++); | for (q = arg--; *q && *q != '('; q++); | ||||
if (*q) { | if (*q) { | ||||
drv = -1; | drv = -1; | ||||
if (arg[1] == ':') { | if (arg[1] == ':') { | ||||
drv = *arg - '0'; | drv = *arg - '0'; | ||||
if (drv > 9) | if (drv > 9) | ||||
Show All 38 Lines |
It would be nice to abstract the 'small parsing routines' down into one copy rather than the 6 we have in the tree today.