summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/boot0/Makefile25
-rw-r--r--sys/boot/i386/libi386/Makefile4
-rw-r--r--sys/boot/i386/libi386/aout_freebsd.c1
-rw-r--r--sys/boot/i386/libi386/biosmem.c1
-rw-r--r--sys/boot/i386/libi386/biospci.c13
-rw-r--r--sys/boot/i386/libi386/biospnp.c15
-rw-r--r--sys/boot/i386/libi386/bootinfo.c12
-rw-r--r--sys/boot/i386/libi386/bootinfo32.c12
-rw-r--r--sys/boot/i386/libi386/bootinfo64.c12
-rw-r--r--sys/boot/i386/libi386/comconsole.c2
-rw-r--r--sys/boot/i386/libi386/elf32_freebsd.c2
-rw-r--r--sys/boot/i386/libi386/elf64_freebsd.c2
-rw-r--r--sys/boot/i386/libi386/elf_freebsd.c2
-rw-r--r--sys/boot/i386/libi386/gatea20.c8
-rw-r--r--sys/boot/i386/libi386/i386_copy.c16
-rw-r--r--sys/boot/i386/libi386/libi386.h34
-rw-r--r--sys/boot/i386/libi386/pxe.c24
-rw-r--r--sys/boot/i386/libi386/time.c8
-rw-r--r--sys/boot/i386/libi386/vidconsole.c13
-rw-r--r--sys/boot/i386/loader/main.c49
20 files changed, 143 insertions, 112 deletions
diff --git a/sys/boot/i386/boot0/Makefile b/sys/boot/i386/boot0/Makefile
index a40e780..92bba82 100644
--- a/sys/boot/i386/boot0/Makefile
+++ b/sys/boot/i386/boot0/Makefile
@@ -8,24 +8,33 @@ BINMODE= 444
M4?= m4
-# update, packet mode, and all slices enabled by default
-B0FLAGS=0x8f
-B0TICKS=0xb6
+# The default set of flags compiled into boot0. This enables update (writing
+# the modified boot0 back to disk after running so that the selection made is
+# saved), packet mode (detect and use the BIOS EDD extensions if we try to
+# boot past the 1024 cylinder liimt), and booting from all valid slices.
+BOOT_BOOT0_FLAGS?= 0x8f
-ORG= 0x600
+# The number of timer ticks to wait for a keypress before assuming the default
+# selection. Since there are 18.2 ticks per second, the default value of
+# 0xb6 (182d) corresponds to 10 seconds.
+BOOT_BOOT0_TICKS?= 0xb6
+
+# The base address that we the boot0 code to to run it. Don't change this
+# unless you are glutton for punishment.
+BOOT_BOOT0_ORG?= 0x600
boot0: boot0.o
.if ${OBJFORMAT} == aout
- ${LD} -N -s -T ${ORG} -o boot0.out boot0.o
+ ${LD} -N -s -T ${BOOT_BOOT0_ORG} -o boot0.out boot0.o
dd if=boot0.out of=${.TARGET} ibs=32 skip=1
.else
- ${LD} -N -e start -Ttext ${ORG} -o boot0.out boot0.o
+ ${LD} -N -e start -Ttext ${BOOT_BOOT0_ORG} -o boot0.out boot0.o
objcopy -S -O binary boot0.out ${.TARGET}
.endif
boot0.o: boot0.s
- ${AS} ${AFLAGS} --defsym FLAGS=${B0FLAGS} --defsym TICKS=${B0TICKS} \
- ${.IMPSRC} -o ${.TARGET}
+ ${AS} ${AFLAGS} --defsym FLAGS=${BOOT_BOOT0_FLAGS} \
+ --defsym TICKS=${BOOT_BOOT0_TICKS} ${.IMPSRC} -o ${.TARGET}
CLEANFILES+= boot0.out boot0.o
diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
index 36ec6fd..b200aed 100644
--- a/sys/boot/i386/libi386/Makefile
+++ b/sys/boot/i386/libi386/Makefile
@@ -22,8 +22,10 @@ CFLAGS+= -DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
# the location of libstand
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+.ifdef(BOOT_BIOSDISK_DEBUG)
# Make the disk code more talkative
-#CFLAGS+= -DDISK_DEBUG
+CFLAGS+= -DDISK_DEBUG
+.endif
# Include simple terminal emulation (cons25-compatible)
CFLAGS+= -DTERM_EMU
diff --git a/sys/boot/i386/libi386/aout_freebsd.c b/sys/boot/i386/libi386/aout_freebsd.c
index 857dc3a4..aed8d64 100644
--- a/sys/boot/i386/libi386/aout_freebsd.c
+++ b/sys/boot/i386/libi386/aout_freebsd.c
@@ -31,7 +31,6 @@
#include <sys/imgact_aout.h>
#include <sys/reboot.h>
#include <sys/linker.h>
-#include <string.h>
#include <machine/bootinfo.h>
#include <stand.h>
diff --git a/sys/boot/i386/libi386/biosmem.c b/sys/boot/i386/libi386/biosmem.c
index 4bab178..7614e84 100644
--- a/sys/boot/i386/libi386/biosmem.c
+++ b/sys/boot/i386/libi386/biosmem.c
@@ -30,6 +30,7 @@
* Obtain memory configuration information from the BIOS
*/
#include <stand.h>
+#include "libi386.h"
#include "btxv86.h"
vm_offset_t memtop;
diff --git a/sys/boot/i386/libi386/biospci.c b/sys/boot/i386/libi386/biospci.c
index 483384c..356ea12 100644
--- a/sys/boot/i386/libi386/biospci.c
+++ b/sys/boot/i386/libi386/biospci.c
@@ -31,7 +31,6 @@
*/
#include <stand.h>
-#include <string.h>
#include <machine/stdarg.h>
#include <bootstrap.h>
#include <isapnp.h>
@@ -48,7 +47,7 @@
struct pci_progif
{
int pi_code;
- char *pi_name;
+ const char *pi_name;
};
static struct pci_progif progif_null[] = {
@@ -116,7 +115,7 @@ static struct pci_progif progif_parallel[] = {
struct pci_subclass
{
int ps_subclass;
- char *ps_name;
+ const char *ps_name;
struct pci_progif *ps_progif; /* if set, use for programming interface value(s) */
};
@@ -171,7 +170,7 @@ static struct pci_subclass subclass_serial[] = {
static struct pci_class
{
int pc_class;
- char *pc_name;
+ const char *pc_name;
struct pci_subclass *pc_subclass;
} pci_classes[] = {
{0x0, "device", subclass_old},
@@ -199,7 +198,7 @@ struct pnphandler biospcihandler =
static void
biospci_enumerate(void)
{
- int index, locator, devid;
+ int device_index, locator, devid;
struct pci_class *pc;
struct pci_subclass *psc;
struct pci_progif *ppi;
@@ -230,14 +229,14 @@ biospci_enumerate(void)
for (ppi = psc->ps_progif; ppi->pi_code >= 0; ppi++) {
/* Scan for matches */
- for (index = 0; ; index++) {
+ for (device_index = 0; ; device_index++) {
/* Look for a match */
v86.ctl = V86_FLAGS;
v86.addr = 0x1a;
v86.eax = 0xb103;
v86.ecx = (pc->pc_class << 16) + (psc->ps_subclass << 8) + ppi->pi_code;
- v86.esi = index;
+ v86.esi = device_index;
v86int();
/* error/end of matches */
if ((v86.efl & 1) || (v86.eax & 0xff00))
diff --git a/sys/boot/i386/libi386/biospnp.c b/sys/boot/i386/libi386/biospnp.c
index 616a22c..eee77aa 100644
--- a/sys/boot/i386/libi386/biospnp.c
+++ b/sys/boot/i386/libi386/biospnp.c
@@ -31,7 +31,6 @@
*/
#include <stand.h>
-#include <string.h>
#include <machine/stdarg.h>
#include <bootstrap.h>
#include <isapnp.h>
@@ -71,7 +70,7 @@ struct pnp_devNode
u_int8_t dn_id[4] __attribute__ ((packed));
u_int8_t dn_type[3] __attribute__ ((packed));
u_int16_t dn_attrib __attribute__ ((packed));
- u_int8_t dn_data[0] __attribute__ ((packed));
+ u_int8_t dn_data[1] __attribute__ ((packed));
};
struct pnp_isaConfiguration
@@ -87,10 +86,12 @@ static u_int16_t pnp_NumNodes;
static u_int16_t pnp_NodeSize;
static void biospnp_scanresdata(struct pnpinfo *pi, struct pnp_devNode *dn);
-static int biospnp_call(int func, char *fmt, ...);
+static int biospnp_call(int func, const char *fmt, ...);
#define vsegofs(vptr) (((u_int32_t)VTOPSEG(vptr) << 16) + VTOPOFF(vptr))
-void (* v86bios)(u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) = (void *)v86int;
+
+typedef void v86bios_t(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
+v86bios_t *v86bios = (v86bios_t *)v86int;
#define biospnp_f00(NumNodes, NodeSize) biospnp_call(0x00, "ll", NumNodes, NodeSize)
#define biospnp_f01(Node, devNodeBuffer, Control) biospnp_call(0x01, "llw", Node, devNodeBuffer, Control)
@@ -186,7 +187,7 @@ biospnp_enumerate(void)
static void
biospnp_scanresdata(struct pnpinfo *pi, struct pnp_devNode *dn)
{
- int tag, i, rlen, dlen;
+ u_int tag, i, rlen, dlen;
u_int8_t *p;
char *str;
@@ -243,10 +244,10 @@ biospnp_scanresdata(struct pnpinfo *pi, struct pnp_devNode *dn)
* this evil.
*/
static int
-biospnp_call(int func, char *fmt, ...)
+biospnp_call(int func, const char *fmt, ...)
{
va_list ap;
- char *p;
+ const char *p;
u_int8_t *argp;
u_int32_t args[4];
u_int32_t i;
diff --git a/sys/boot/i386/libi386/bootinfo.c b/sys/boot/i386/libi386/bootinfo.c
index 9014265..63be83f 100644
--- a/sys/boot/i386/libi386/bootinfo.c
+++ b/sys/boot/i386/libi386/bootinfo.c
@@ -43,7 +43,7 @@ static struct bootinfo bi;
*/
static struct
{
- char *ev;
+ const char *ev;
int mask;
} howto_names[] = {
{"boot_askname", RB_ASKNAME},
@@ -56,6 +56,8 @@ static struct
{NULL, 0}
};
+vm_offset_t bi_copymodules(vm_offset_t addr);
+
int
bi_getboothowto(char *kargs)
{
@@ -227,7 +229,7 @@ bi_copymodules(vm_offset_t addr)
* Load the information expected by an i386 kernel.
*
* - The 'boothowto' argument is constructed
- * - The 'botdev' argument is constructed
+ * - The 'bootdev' argument is constructed
* - The 'bootinfo' struct is constructed, and copied into the kernel space.
* - The kernel environment is copied into kernel space.
* - Module metadata are formatted and placed in kernel space.
@@ -237,7 +239,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
{
struct preloaded_file *xp;
struct i386_devdesc *rootdev;
- vm_offset_t addr, bootinfo_addr;
+ vm_offset_t addr;
char *rootdevname;
int bootdevnr, i;
u_int pad;
@@ -262,6 +264,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
getrootmount(i386_fmtdev((void *)rootdev));
/* Do legacy rootdev guessing */
+
+ /* XXX - use a default bootdev of 0. Is this ok??? */
+ bootdevnr = 0;
+
switch(rootdev->d_type) {
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
diff --git a/sys/boot/i386/libi386/bootinfo32.c b/sys/boot/i386/libi386/bootinfo32.c
index 9014265..63be83f 100644
--- a/sys/boot/i386/libi386/bootinfo32.c
+++ b/sys/boot/i386/libi386/bootinfo32.c
@@ -43,7 +43,7 @@ static struct bootinfo bi;
*/
static struct
{
- char *ev;
+ const char *ev;
int mask;
} howto_names[] = {
{"boot_askname", RB_ASKNAME},
@@ -56,6 +56,8 @@ static struct
{NULL, 0}
};
+vm_offset_t bi_copymodules(vm_offset_t addr);
+
int
bi_getboothowto(char *kargs)
{
@@ -227,7 +229,7 @@ bi_copymodules(vm_offset_t addr)
* Load the information expected by an i386 kernel.
*
* - The 'boothowto' argument is constructed
- * - The 'botdev' argument is constructed
+ * - The 'bootdev' argument is constructed
* - The 'bootinfo' struct is constructed, and copied into the kernel space.
* - The kernel environment is copied into kernel space.
* - Module metadata are formatted and placed in kernel space.
@@ -237,7 +239,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
{
struct preloaded_file *xp;
struct i386_devdesc *rootdev;
- vm_offset_t addr, bootinfo_addr;
+ vm_offset_t addr;
char *rootdevname;
int bootdevnr, i;
u_int pad;
@@ -262,6 +264,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
getrootmount(i386_fmtdev((void *)rootdev));
/* Do legacy rootdev guessing */
+
+ /* XXX - use a default bootdev of 0. Is this ok??? */
+ bootdevnr = 0;
+
switch(rootdev->d_type) {
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
diff --git a/sys/boot/i386/libi386/bootinfo64.c b/sys/boot/i386/libi386/bootinfo64.c
index 9014265..63be83f 100644
--- a/sys/boot/i386/libi386/bootinfo64.c
+++ b/sys/boot/i386/libi386/bootinfo64.c
@@ -43,7 +43,7 @@ static struct bootinfo bi;
*/
static struct
{
- char *ev;
+ const char *ev;
int mask;
} howto_names[] = {
{"boot_askname", RB_ASKNAME},
@@ -56,6 +56,8 @@ static struct
{NULL, 0}
};
+vm_offset_t bi_copymodules(vm_offset_t addr);
+
int
bi_getboothowto(char *kargs)
{
@@ -227,7 +229,7 @@ bi_copymodules(vm_offset_t addr)
* Load the information expected by an i386 kernel.
*
* - The 'boothowto' argument is constructed
- * - The 'botdev' argument is constructed
+ * - The 'bootdev' argument is constructed
* - The 'bootinfo' struct is constructed, and copied into the kernel space.
* - The kernel environment is copied into kernel space.
* - Module metadata are formatted and placed in kernel space.
@@ -237,7 +239,7 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
{
struct preloaded_file *xp;
struct i386_devdesc *rootdev;
- vm_offset_t addr, bootinfo_addr;
+ vm_offset_t addr;
char *rootdevname;
int bootdevnr, i;
u_int pad;
@@ -262,6 +264,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip)
getrootmount(i386_fmtdev((void *)rootdev));
/* Do legacy rootdev guessing */
+
+ /* XXX - use a default bootdev of 0. Is this ok??? */
+ bootdevnr = 0;
+
switch(rootdev->d_type) {
case DEVT_DISK:
/* pass in the BIOS device number of the current disk */
diff --git a/sys/boot/i386/libi386/comconsole.c b/sys/boot/i386/libi386/comconsole.c
index ee6fbc8..9440b3a 100644
--- a/sys/boot/i386/libi386/comconsole.c
+++ b/sys/boot/i386/libi386/comconsole.c
@@ -114,7 +114,7 @@ comc_putchar(int c)
for (wait = COMC_TXWAIT; wait > 0; wait--)
if (inb(COMPORT + com_lsr) & LSR_TXRDY) {
- outb(COMPORT + com_data, c);
+ outb(COMPORT + com_data, (u_char)c);
break;
}
}
diff --git a/sys/boot/i386/libi386/elf32_freebsd.c b/sys/boot/i386/libi386/elf32_freebsd.c
index a3ad9fb..c35cc5a 100644
--- a/sys/boot/i386/libi386/elf32_freebsd.c
+++ b/sys/boot/i386/libi386/elf32_freebsd.c
@@ -43,8 +43,6 @@ static int elf_exec(struct preloaded_file *amp);
struct file_format i386_elf = { elf_loadfile, elf_exec };
-static struct bootinfo bi;
-
/*
* There is an a.out kernel and one or more a.out modules loaded.
* We wish to start executing the kernel image, so make such
diff --git a/sys/boot/i386/libi386/elf64_freebsd.c b/sys/boot/i386/libi386/elf64_freebsd.c
index a3ad9fb..c35cc5a 100644
--- a/sys/boot/i386/libi386/elf64_freebsd.c
+++ b/sys/boot/i386/libi386/elf64_freebsd.c
@@ -43,8 +43,6 @@ static int elf_exec(struct preloaded_file *amp);
struct file_format i386_elf = { elf_loadfile, elf_exec };
-static struct bootinfo bi;
-
/*
* There is an a.out kernel and one or more a.out modules loaded.
* We wish to start executing the kernel image, so make such
diff --git a/sys/boot/i386/libi386/elf_freebsd.c b/sys/boot/i386/libi386/elf_freebsd.c
index a3ad9fb..c35cc5a 100644
--- a/sys/boot/i386/libi386/elf_freebsd.c
+++ b/sys/boot/i386/libi386/elf_freebsd.c
@@ -43,8 +43,6 @@ static int elf_exec(struct preloaded_file *amp);
struct file_format i386_elf = { elf_loadfile, elf_exec };
-static struct bootinfo bi;
-
/*
* There is an a.out kernel and one or more a.out modules loaded.
* We wish to start executing the kernel image, so make such
diff --git a/sys/boot/i386/libi386/gatea20.c b/sys/boot/i386/libi386/gatea20.c
index b852654..6797118 100644
--- a/sys/boot/i386/libi386/gatea20.c
+++ b/sys/boot/i386/libi386/gatea20.c
@@ -5,10 +5,10 @@
/* extracted from freebsd:sys/i386/boot/biosboot/io.c */
-#include <sys/types.h>
+#include <stand.h>
#include <machine/cpufunc.h>
-#include <stand.h>
+#include <bootstrap.h>
#include "libi386.h"
@@ -36,7 +36,7 @@ void gateA20()
__asm("pushfl ; cli");
#ifdef IBM_L40
outb(0x92, 0x2);
-#else IBM_L40
+#else /* !IBM_L40 */
while (inb(K_STATUS) & K_IBUF_FUL);
while (inb(K_STATUS) & K_OBUF_FUL)
(void)inb(K_RDWR);
@@ -47,6 +47,6 @@ void gateA20()
outb(K_RDWR, x_20);
delay(100);
while (inb(K_STATUS) & K_IBUF_FUL);
-#endif IBM_L40
+#endif /* IBM_L40 */
__asm("popfl");
}
diff --git a/sys/boot/i386/libi386/i386_copy.c b/sys/boot/i386/libi386/i386_copy.c
index 02f8b87..f7cc2f0 100644
--- a/sys/boot/i386/libi386/i386_copy.c
+++ b/sys/boot/i386/libi386/i386_copy.c
@@ -38,8 +38,8 @@
#define READIN_BUF (16 * 1024)
-int
-i386_copyin(void *src, vm_offset_t dest, size_t len)
+ssize_t
+i386_copyin(const void *src, vm_offset_t dest, const size_t len)
{
if (dest + len >= memtop) {
errno = EFBIG;
@@ -50,8 +50,8 @@ i386_copyin(void *src, vm_offset_t dest, size_t len)
return(len);
}
-int
-i386_copyout(vm_offset_t src, void *dest, size_t len)
+ssize_t
+i386_copyout(const vm_offset_t src, void *dest, const size_t len)
{
if (src + len >= memtop) {
errno = EFBIG;
@@ -63,8 +63,8 @@ i386_copyout(vm_offset_t src, void *dest, size_t len)
}
-int
-i386_readin(int fd, vm_offset_t dest, size_t len)
+ssize_t
+i386_readin(const int fd, vm_offset_t dest, const size_t len)
{
void *buf;
size_t resid, chunk, get;
@@ -83,10 +83,8 @@ i386_readin(int fd, vm_offset_t dest, size_t len)
got = read(fd, buf, get);
if (got <= 0)
break;
- bcopy(buf, PTOV(dest), got);
+ bcopy(buf, PTOV(dest), (size_t)got);
}
free(buf);
return(len - resid);
}
-
-
diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h
index 3061dc7..3db8f06 100644
--- a/sys/boot/i386/libi386/libi386.h
+++ b/sys/boot/i386/libi386/libi386.h
@@ -52,9 +52,9 @@ struct i386_devdesc
} d_kind;
};
-extern int i386_getdev(void **vdev, const char *devspec, const char **path);
-extern char *i386_fmtdev(void *vdev);
-extern int i386_setcurrdev(struct env_var *ev, int flags, void *value);
+int i386_getdev(void **vdev, const char *devspec, const char **path);
+char *i386_fmtdev(void *vdev);
+int i386_setcurrdev(struct env_var *ev, int flags, void *value);
extern struct devdesc currdev; /* our current device */
@@ -65,26 +65,26 @@ extern struct devsw biosdisk;
extern struct devsw pxedisk;
extern struct fs_ops pxe_fsops;
-u_int32_t bd_getbigeom(int bunit); /* return geometry in bootinfo format */
-extern int bd_bios2unit(int biosdev); /* xlate BIOS device -> biosdisk unit */
-extern int bd_unit2bios(int unit); /* xlate biosdisk unit -> BIOS device */
-extern int bd_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */
+u_int32_t bd_getbigeom(int bunit); /* return geometry in bootinfo format */
+int bd_bios2unit(int biosdev); /* xlate BIOS device -> biosdisk unit */
+int bd_unit2bios(int unit); /* xlate biosdisk unit -> BIOS device */
+int bd_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */
-extern int i386_copyin(void *src, vm_offset_t dest, size_t len);
-extern int i386_copyout(vm_offset_t src, void *dest, size_t len);
-extern int i386_readin(int fd, vm_offset_t dest, size_t len);
+ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len);
+ssize_t i386_copyout(const vm_offset_t src, void *dest, const size_t len);
+ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len);
-extern void bios_getmem(void);
+void bios_getmem(void);
extern u_int32_t bios_basemem; /* base memory in bytes */
extern u_int32_t bios_extmem; /* extended memory in bytes */
extern vm_offset_t memtop;
-extern void gateA20(void);
+void gateA20(void);
-extern int i386_autoload(void);
+int i386_autoload(void);
-extern int bi_getboothowto(char *kargs);
-extern vm_offset_t bi_copyenv(vm_offset_t addr);
-extern int bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip);
+int bi_getboothowto(char *kargs);
+vm_offset_t bi_copyenv(vm_offset_t addr);
+int bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip);
-extern void pxe_enable(void *pxeinfo);
+void pxe_enable(void *pxeinfo);
diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c
index d6737c2..471bd6d 100644
--- a/sys/boot/i386/libi386/pxe.c
+++ b/sys/boot/i386/libi386/pxe.c
@@ -59,7 +59,7 @@ static pxenv_t *pxenv_p = NULL; /* PXENV+ */
static pxe_t *pxe_p = NULL; /* !PXE */
static BOOTPLAYER bootplayer; /* PXE Cached information. */
-static int debug = 0;
+static int pxe_debug = 0;
static int pxe_sock = -1;
static int pxe_opens = 0;
@@ -70,7 +70,7 @@ static void bangpxe_call(int func);
static int pxe_init(void);
static int pxe_strategy(void *devdata, int flag, daddr_t dblk,
- size_t size, void *buf, size_t *rsize);
+ size_t size, char *buf, size_t *rsize);
static int pxe_open(struct open_file *f, ...);
static int pxe_close(struct open_file *f);
static void pxe_print(int verbose);
@@ -86,8 +86,6 @@ static int pxe_netif_put(struct iodesc *desc, void *pkt, size_t len);
static void pxe_netif_end(struct netif *nif);
extern struct netif_stats pxe_st[];
-extern struct in_addr rootip;
-extern char rootpath[FNAME_SIZE];
extern u_int16_t __bangpxeseg;
extern u_int16_t __bangpxeoff;
extern void __bangpxeentry(void);
@@ -241,7 +239,7 @@ pxe_init(void)
static int
pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
- void *buf, size_t *rsize)
+ char *buf, size_t *rsize)
{
return (EIO);
}
@@ -268,7 +266,7 @@ pxe_open(struct open_file *f, ...)
printf("pxe_open: netif_open() failed\n");
return (ENXIO);
}
- if (debug)
+ if (pxe_debug)
printf("pxe_open: netif_open() succeeded\n");
}
if (rootip.s_addr == 0) {
@@ -307,7 +305,7 @@ pxe_close(struct open_file *f)
{
#ifdef PXE_DEBUG
- if (debug)
+ if (pxe_debug)
printf("pxe_close: opens=%d\n", pxe_opens);
#endif
@@ -323,7 +321,7 @@ pxe_close(struct open_file *f)
if (pxe_sock >= 0) {
#ifdef PXE_DEBUG
- if (debug)
+ if (pxe_debug)
printf("pxe_close: calling netif_close()\n");
#endif
netif_close(pxe_sock);
@@ -352,10 +350,12 @@ pxe_print(int verbose)
static void
pxe_cleanup(void)
{
+#ifdef PXE_DEBUG
t_PXENV_UNLOAD_STACK *unload_stack_p =
(t_PXENV_UNLOAD_STACK *)scratch_buffer;
t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p =
(t_PXENV_UNDI_SHUTDOWN *)scratch_buffer;
+#endif
if (pxe_call == NULL)
return;
@@ -363,7 +363,7 @@ pxe_cleanup(void)
pxe_call(PXENV_UNDI_SHUTDOWN);
#ifdef PXE_DEBUG
- if (debug && undi_shutdown_p->Status != 0)
+ if (pxe_debug && undi_shutdown_p->Status != 0)
printf("pxe_cleanup: UNDI_SHUTDOWN failed %x\n",
undi_shutdown_p->Status);
#endif
@@ -371,7 +371,7 @@ pxe_cleanup(void)
pxe_call(PXENV_UNLOAD_STACK);
#ifdef PXE_DEBUG
- if (debug && unload_stack_p->Status != 0)
+ if (pxe_debug && unload_stack_p->Status != 0)
printf("pxe_cleanup: UNLOAD_STACK failed %x\n",
unload_stack_p->Status);
#endif
@@ -387,7 +387,7 @@ void
pxenv_call(int func)
{
#ifdef PXE_DEBUG
- if (debug)
+ if (pxe_debug)
printf("pxenv_call %x\n", func);
#endif
@@ -410,7 +410,7 @@ void
bangpxe_call(int func)
{
#ifdef PXE_DEBUG
- if (debug)
+ if (pxe_debug)
printf("bangpxe_call %x\n", func);
#endif
diff --git a/sys/boot/i386/libi386/time.c b/sys/boot/i386/libi386/time.c
index 0a3981f..8176ebb 100644
--- a/sys/boot/i386/libi386/time.c
+++ b/sys/boot/i386/libi386/time.c
@@ -28,6 +28,8 @@
#include <stand.h>
#include <btxv86.h>
+#include "bootstrap.h"
+#include "libi386.h"
/*
* Return the time in seconds since the beginning of the day.
@@ -41,7 +43,7 @@ time_t
time(time_t *t)
{
static time_t lasttime, now;
- int hr, min, sec;
+ int hr, minute, sec;
v86.ctl = 0;
v86.addr = 0x1a; /* int 0x1a, function 2 */
@@ -49,10 +51,10 @@ time(time_t *t)
v86int();
hr = bcd2bin((v86.ecx & 0xff00) >> 8); /* hour in %ch */
- min = bcd2bin(v86.ecx & 0xff); /* minute in %cl */
+ minute = bcd2bin(v86.ecx & 0xff); /* minute in %cl */
sec = bcd2bin((v86.edx & 0xff00) >> 8); /* second in %dh */
- now = hr * 3600 + min * 60 + sec;
+ now = hr * 3600 + minute * 60 + sec;
if (now < lasttime)
now += 24 * 3600;
lasttime = now;
diff --git a/sys/boot/i386/libi386/vidconsole.c b/sys/boot/i386/libi386/vidconsole.c
index a79bb05..56841a5 100644
--- a/sys/boot/i386/libi386/vidconsole.c
+++ b/sys/boot/i386/libi386/vidconsole.c
@@ -49,13 +49,14 @@ static int vidc_ischar(void);
static int vidc_started;
#ifdef TERM_EMU
-void end_term();
+void end_term(void);
void bail_out(int c);
void vidc_term_emu(int c);
void get_pos(void);
void curs_move(int x, int y);
void write_char(int c, int fg, int bg);
void scroll_up(int rows, int fg, int bg);
+int pow10(int i);
void AB(void);
void AF(void);
void CD(void);
@@ -104,7 +105,7 @@ vidc_init(int arg)
int i;
if (vidc_started && arg == 0)
- return;
+ return(0);
vidc_started = 1;
#ifdef TERM_EMU
/* Init terminal emulator */
@@ -234,13 +235,13 @@ curs_move(int x, int y)
* inserted in the window.
*/
void
-scroll_up(int rows, int fg, int bg)
+scroll_up(int rows, int fgcol, int bgcol)
{
if(rows==0) rows=25;
v86.ctl = 0;
v86.addr = 0x10;
v86.eax = 0x0600+(0x00ff & rows);
- v86.ebx = (bg<<12)+(fg<<8);
+ v86.ebx = (bgcol<<12)+(fgcol<<8);
v86.ecx = 0x0;
v86.edx = 0x184f;
v86int();
@@ -248,12 +249,12 @@ scroll_up(int rows, int fg, int bg)
/* Write character and attribute at cursor position. */
void
-write_char(int c, int fg, int bg)
+write_char(int c, int fgcol, int bgcol)
{
v86.ctl=0;
v86.addr = 0x10;
v86.eax = 0x0900+(0x00ff & c);
- v86.ebx = (bg<<4)+fg;
+ v86.ebx = (bgcol<<4)+fgcol;
v86.ecx = 0x1;
v86int();
}
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index a078c6d..f675475 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -63,6 +63,7 @@ struct arch_switch archsw; /* MI/MD interface boundary */
static void extract_currdev(void);
static int isa_inb(int port);
static void isa_outb(int port, int value);
+void exit(int code);
/* from vers.c */
extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
@@ -70,7 +71,7 @@ extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
/* XXX debugging */
extern char end[];
-void
+int
main(void)
{
int i;
@@ -138,6 +139,9 @@ main(void)
archsw.arch_isaoutb = isa_outb;
interact(); /* doesn't return */
+
+ /* if we ever get here, it is an error */
+ return (1);
}
/*
@@ -149,40 +153,41 @@ main(void)
static void
extract_currdev(void)
{
- struct i386_devdesc currdev;
+ struct i386_devdesc new_currdev;
int major, biosdev;
/* Assume we are booting from a BIOS disk by default */
- currdev.d_dev = &biosdisk;
- currdev.d_type = currdev.d_dev->dv_type;
+ new_currdev.d_dev = &biosdisk;
+ new_currdev.d_type = new_currdev.d_dev->dv_type;
/* new-style boot loaders such as pxeldr and cdldr */
if (kargs->bootinfo == NULL) {
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
/* we are booting from a CD with cdldr */
- currdev.d_kind.biosdisk.slice = -1;
- currdev.d_kind.biosdisk.partition = 0;
+ new_currdev.d_kind.biosdisk.slice = -1;
+ new_currdev.d_kind.biosdisk.partition = 0;
biosdev = initial_bootdev;
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
/* we are booting from pxeldr */
- currdev.d_dev = &pxedisk;
- currdev.d_type = currdev.d_dev->dv_type;
- currdev.d_kind.netif.unit = 0;
+ new_currdev.d_dev = &pxedisk;
+ new_currdev.d_type = new_currdev.d_dev->dv_type;
+ new_currdev.d_kind.netif.unit = 0;
+ biosdev = -1;
} else {
/* we don't know what our boot device is */
- currdev.d_kind.biosdisk.slice = -1;
- currdev.d_kind.biosdisk.partition = 0;
+ new_currdev.d_kind.biosdisk.slice = -1;
+ new_currdev.d_kind.biosdisk.partition = 0;
biosdev = -1;
}
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
/* The passed-in boot device is bad */
- currdev.d_kind.biosdisk.slice = -1;
- currdev.d_kind.biosdisk.partition = 0;
+ new_currdev.d_kind.biosdisk.slice = -1;
+ new_currdev.d_kind.biosdisk.partition = 0;
biosdev = -1;
} else {
- currdev.d_kind.biosdisk.slice = (B_ADAPTOR(initial_bootdev) << 4) +
- B_CONTROLLER(initial_bootdev) - 1;
- currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
+ new_currdev.d_kind.biosdisk.slice = (B_ADAPTOR(initial_bootdev) << 4) +
+ B_CONTROLLER(initial_bootdev) - 1;
+ new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
biosdev = initial_bootinfo->bi_bios_dev;
major = B_TYPE(initial_bootdev);
@@ -200,14 +205,16 @@ extract_currdev(void)
* If we are booting off of a BIOS disk and we didn't succeed in determining
* which one we booted off of, just use disk0: as a reasonable default.
*/
- if ((currdev.d_type == devsw[0]->dv_type) &&
- ((currdev.d_kind.biosdisk.unit = bd_bios2unit(biosdev)) == -1)) {
+ if ((new_currdev.d_type == devsw[0]->dv_type) &&
+ ((new_currdev.d_kind.biosdisk.unit = bd_bios2unit(biosdev)) == -1)) {
printf("Can't work out which disk we are booting from.\n"
"Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev);
- currdev.d_kind.biosdisk.unit = 0;
+ new_currdev.d_kind.biosdisk.unit = 0;
}
- env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&currdev), i386_setcurrdev, env_nounset);
- env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&currdev), env_noset, env_nounset);
+ env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
+ i386_setcurrdev, env_nounset);
+ env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset,
+ env_nounset);
}
COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
OpenPOWER on IntegriCloud