diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-10-30 22:41:57 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-10-30 22:41:57 +0000 |
commit | 072b56c97e17e8e69ddab5a735b5297387a88a70 (patch) | |
tree | 22eaee09956502609c240ddff8a108d8733521f9 /sys/arch/alpha/stand/boot | |
parent | b85b15782739220b5bf2563ccdc7ac9e256a31d2 (diff) |
Merge to NetBSD 961020. Retained our kernel APIs where NetBSD has changed.
-Wall -Wstrict-prototypes -Wmissing-prototypes too.
Diffstat (limited to 'sys/arch/alpha/stand/boot')
-rw-r--r-- | sys/arch/alpha/stand/boot/Makefile | 27 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/boot.c | 209 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/conf.c | 2 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/devopen.c | 2 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/disk.c | 2 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/disk.h | 2 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/filesystem.c | 2 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/newvers.sh | 8 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/prom_swpal.S | 11 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/test.c | 2 | ||||
-rw-r--r-- | sys/arch/alpha/stand/boot/version | 7 |
11 files changed, 47 insertions, 227 deletions
diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile index d3c510de833..bf32ff1073a 100644 --- a/sys/arch/alpha/stand/boot/Makefile +++ b/sys/arch/alpha/stand/boot/Makefile @@ -1,12 +1,13 @@ -# $OpenBSD: Makefile,v 1.4 1996/07/29 23:01:31 niklas Exp $ -# $NetBSD: Makefile,v 1.6 1996/04/12 01:35:15 cgd Exp $ +# $OpenBSD: Makefile,v 1.5 1996/10/30 22:40:38 niklas Exp $ +# $NetBSD: Makefile,v 1.10 1996/10/18 06:01:41 thorpej Exp $ .PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa BOOT_PROG = boot BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS} -BOOT_SRCS = start.S boot.c disk.c conf.c prom.c prom_disp.S OSFpal.c +BOOT_SRCS = start.S boot.c loadfile.c disk.c conf.c prom.c prom_disp.S OSFpal.c + BOOT_SRCS+= alloc.c bzero.c close.c dev.c devopen.c disklabel.c dkcksum.c BOOT_SRCS+= getfile.c gets.c ioctl.c lseek.c open.c printf.c read.c BOOT_SRCS+= strcmp.c ufs.c write.c bcopy.c filesystem.c strlen.c @@ -15,9 +16,11 @@ BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g} HEADERSIZE_PROG = headersize -AFLAGS += -DASSEMBLER +DEFNS= -DCOMPAT_UFS -DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF + +AFLAGS += -DASSEMBLER ${DEFNS} CPPFLAGS += -I${.CURDIR}/../.. -I${.CURDIR}/../../../.. -CFLAGS = -Werror -mno-fp-regs -g -DCOMPAT_UFS +CFLAGS = -Werror -mno-fp-regs -g ${DEFNS} CLEANFILES+= vers.c vers.o @@ -28,21 +31,21 @@ all: ${BOOT_PROG} ${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG} sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${COMPILE.c} vers.c - ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.coff \ + ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.hdr \ ${BOOT_OBJS} vers.o -lc # XXX - size ${BOOT_PROG}.coff - strip ${BOOT_PROG}.coff - dd if=${BOOT_PROG}.coff of=${BOOT_PROG} \ - bs=`./${HEADERSIZE_PROG} < ${BOOT_PROG}.coff` skip=1 + size ${BOOT_PROG}.hdr + strip ${BOOT_PROG}.hdr + dd if=${BOOT_PROG}.hdr of=${BOOT_PROG} \ + bs=`./${HEADERSIZE_PROG} ${BOOT_RELOC} ${BOOT_PROG}.hdr` skip=1 install: - install -c -o bin -g bin -m 444 ${BOOT_PROG} \ + ${INSTALL} -c -o bin -g bin -m 444 ${BOOT_PROG} \ ${DESTDIR}${BINDIR}/${BOOT_PROG} clean: _SUBDIRUSE rm -f a.out [Ee]rrs mklog core *.core \ ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \ - ${BOOT_PROG}.coff ${HEADERSIZE_PROG} + ${BOOT_PROG}.hdr ${HEADERSIZE_PROG} cleandir: _SUBDIRUSE clean diff --git a/sys/arch/alpha/stand/boot/boot.c b/sys/arch/alpha/stand/boot/boot.c index 2ce83ae8f00..a585b2b3ed6 100644 --- a/sys/arch/alpha/stand/boot/boot.c +++ b/sys/arch/alpha/stand/boot/boot.c @@ -1,5 +1,5 @@ -/* $OpenBSD: boot.c,v 1.5 1996/07/31 16:24:11 niklas Exp $ */ -/* $NetBSD: boot.c,v 1.6 1996/05/10 00:15:08 cgd Exp $ */ +/* $OpenBSD: boot.c,v 1.6 1996/10/30 22:40:39 niklas Exp $ */ +/* $NetBSD: boot.c,v 1.8 1996/09/17 22:00:26 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -51,52 +51,25 @@ #define _KERNEL #include "include/pte.h" -static int aout_exec __P((int, struct exec *, u_int64_t *)); -static int coff_exec __P((int, struct ecoff_exechdr *, u_int64_t *)); -static int loadfile __P((char *, u_int64_t *)); - -char line[64] = "/bsd"; +int loadfile __P((char *, u_int64_t *)); char boot_file[128]; -char boot_dev[128]; char boot_flags[128]; -char boot_console[8]; extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; -#define KERNEL_ARGC 4 -char *kernel_argv[KERNEL_ARGC+1] = { - boot_file, - boot_flags, - boot_console, - boot_dev, - NULL -}; - vm_offset_t ffp_save, ptbr_save; void -main(argc, argv, envp) - int argc; - char **argv; - char **envp; +main() { u_int64_t entry; - int ask; - prom_return_t ret; - -#ifdef notdef - { - extern char *_EDATA, *_end; - bzero(_EDATA, _end - _EDATA); - } -#endif /* Init prom callback vector. */ init_prom_calls(); /* print a banner */ - printf("\n\n"); + printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); printf("\n"); @@ -106,177 +79,19 @@ main(argc, argv, envp) printf("\n"); - prom_getenv(PROM_E_BOOTED_DEV, boot_dev, sizeof(boot_dev)); prom_getenv(PROM_E_BOOTED_FILE, boot_file, sizeof(boot_file)); prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags)); - prom_getenv(PROM_E_TTY_DEV, boot_console, sizeof(boot_console)); - - printf("boot_dev = \"%s\"\n", boot_dev); - printf("boot_file = \"%s\"\n", boot_file); - printf("boot_flags = \"%s\"\n", boot_flags); - printf("boot_console = \"%s\"\n", boot_console); if (boot_file[0] == '\0') - bcopy(line, boot_file, strlen(line)+1); - -#ifdef JUSTASK - ask = 1; -#else - ask = 0; -#endif - for (;;) { - if (ask) { - (void)printf("Boot: "); - gets(line); - if (line[0] == '\0') - continue; - if (!strcmp(line, "halt")) - halt(); -/* XXX TURN LINE INTO BOOT FILE/FLAGS */ - bcopy(line, boot_file, strlen(line)+1); - } else - (void)printf("Boot: %s %s\n", boot_file, boot_flags); - - if (!loadfile(boot_file, &entry)) { - -printf("calling %lx with %lx, %lx, %lx, %lx, %lx\n", entry, -ffp_save, ptbr_save, KERNEL_ARGC, kernel_argv, NULL); - (*(void (*)())entry)(ffp_save, ptbr_save, KERNEL_ARGC, - kernel_argv, NULL); - } - - ask = 1; - } - /* NOTREACHED */ -} - -/* - * Open 'filename', read in program and return the entry point or -1 if error. - */ -static int -loadfile(fname, entryp) - char *fname; - u_int64_t *entryp; -{ - struct devices *dp; - union { - struct exec aout; - struct ecoff_exechdr coff; - } hdr; - ssize_t nr; - int fd, rval; - - /* Open the file. */ - rval = 1; - if ((fd = open(fname, 0)) < 0) { - (void)printf("open error: %d\n", errno); - goto err; - } - - /* Read the exec header. */ - if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) { - (void)printf("read error: %d\n", errno); - goto err; - } - - /* Exec a.out or COFF. */ - rval = ECOFF_BADMAG(&hdr.coff) ? /* XXX check aouthdr */ - aout_exec(fd, &hdr.aout, entryp) : - coff_exec(fd, &hdr.coff, entryp); + bcopy("bsd", boot_file, sizeof "bsd"); -err: -#ifndef SMALL - if (fd >= 0) - (void)close(fd); -#endif - if (rval) - (void)printf("can't boot '%s'\n", fname); - return (rval); -} - -static int -aout_exec(fd, aout, entryp) - int fd; - struct exec *aout; - u_int64_t *entryp; -{ - size_t sz; + (void)printf("Boot: %s %s\n", boot_file, boot_flags); - /* Check the magic number. */ - if (N_GETMAGIC(*aout) != OMAGIC) { - (void)printf("bad magic: %o\n", N_GETMAGIC(*aout)); - return (1); - } - - /* Read in text, data. */ - (void)printf("%lu+%lu", aout->a_text, aout->a_data); - if (lseek(fd, (off_t)N_TXTOFF(*aout), SEEK_SET) < 0) { - (void)printf("lseek: %d\n", errno); - return (1); - } - sz = aout->a_text + aout->a_data; - if (read(fd, (void *)aout->a_entry, sz) != sz) { - (void)printf("read text/data: %d\n", errno); - return (1); + if (!loadfile(boot_file, &entry)) { + (void)printf("Entering kernel at 0x%lx...\n", entry); + (*(void (*)())entry)(ffp_save, ptbr_save, 0); } - /* Zero out bss. */ - if (aout->a_bss != 0) { - (void)printf("+%lu", aout->a_bss); - bzero(aout->a_entry + sz, aout->a_bss); - } - - ffp_save = aout->a_entry + aout->a_text + aout->a_data + aout->a_bss; - ffp_save = k0segtophys((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT; - ffp_save += 2; /* XXX OSF/1 does this, no idea why. */ - - (void)printf("\n"); - *entryp = aout->a_entry; - return (0); -} - -static int -coff_exec(fd, coff, entryp) - int fd; - struct ecoff_exechdr *coff; - u_int64_t *entryp; -{ - - /* Read in text. */ - (void)printf("%lu", coff->a.tsize); - (void)lseek(fd, ECOFF_TXTOFF(coff), 0); - if (read(fd, (void *)coff->a.text_start, coff->a.tsize) != - coff->a.tsize) { - (void)printf("read text: %d\n", errno); - return (1); - } - - /* Read in data. */ - if (coff->a.dsize != 0) { - (void)printf("+%lu", coff->a.dsize); - if (read(fd, (void *)coff->a.data_start, coff->a.dsize) != - coff->a.dsize) { - (void)printf("read data: %d\n", errno); - return (1); - } - } - - - /* Zero out bss. */ - if (coff->a.bsize != 0) { - (void)printf("+%lu", coff->a.bsize); - bzero(coff->a.bss_start, coff->a.bsize); - } - - ffp_save = coff->a.text_start + coff->a.tsize; - if (ffp_save < coff->a.data_start + coff->a.dsize) - ffp_save = coff->a.data_start + coff->a.dsize; - if (ffp_save < coff->a.bss_start + coff->a.bsize) - ffp_save = coff->a.bss_start + coff->a.bsize; - ffp_save = k0segtophys((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT; - ffp_save += 2; /* XXX OSF/1 does this, no idea why. */ - - (void)printf("\n"); - *entryp = coff->a.entry; - return (0); + (void)printf("Boot failed! Halting...\n"); + halt(); } diff --git a/sys/arch/alpha/stand/boot/conf.c b/sys/arch/alpha/stand/boot/conf.c index 4c275c4513c..3883551a738 100644 --- a/sys/arch/alpha/stand/boot/conf.c +++ b/sys/arch/alpha/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.3 1996/07/29 23:01:35 niklas Exp $ */ +/* $OpenBSD: conf.c,v 1.4 1996/10/30 22:40:40 niklas Exp $ */ /* $NetBSD: conf.c,v 1.3 1995/11/23 02:39:31 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/devopen.c b/sys/arch/alpha/stand/boot/devopen.c index b25bdfb7318..2e9cbc1951d 100644 --- a/sys/arch/alpha/stand/boot/devopen.c +++ b/sys/arch/alpha/stand/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.2 1996/07/29 23:01:36 niklas Exp $ */ +/* $OpenBSD: devopen.c,v 1.3 1996/10/30 22:40:41 niklas Exp $ */ /* $NetBSD: devopen.c,v 1.1 1995/11/23 02:39:37 cgd Exp $ */ /*- diff --git a/sys/arch/alpha/stand/boot/disk.c b/sys/arch/alpha/stand/boot/disk.c index 3566a0036b3..5b70adf9a61 100644 --- a/sys/arch/alpha/stand/boot/disk.c +++ b/sys/arch/alpha/stand/boot/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.3 1996/07/29 23:01:38 niklas Exp $ */ +/* $OpenBSD: disk.c,v 1.4 1996/10/30 22:40:42 niklas Exp $ */ /* $NetBSD: disk.c,v 1.3 1995/11/23 02:39:40 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/disk.h b/sys/arch/alpha/stand/boot/disk.h index 43f5e0be52b..264c773ceea 100644 --- a/sys/arch/alpha/stand/boot/disk.h +++ b/sys/arch/alpha/stand/boot/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.2 1996/07/29 23:01:39 niklas Exp $ */ +/* $OpenBSD: disk.h,v 1.3 1996/10/30 22:40:42 niklas Exp $ */ /* $NetBSD: disk.h,v 1.1 1995/11/23 02:39:42 cgd Exp $ */ int diskstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); diff --git a/sys/arch/alpha/stand/boot/filesystem.c b/sys/arch/alpha/stand/boot/filesystem.c index 4833ce6acec..1956f3504fa 100644 --- a/sys/arch/alpha/stand/boot/filesystem.c +++ b/sys/arch/alpha/stand/boot/filesystem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filesystem.c,v 1.2 1996/07/29 23:01:41 niklas Exp $ */ +/* $OpenBSD: filesystem.c,v 1.3 1996/10/30 22:40:43 niklas Exp $ */ /* $NetBSD: filesystem.c,v 1.1 1995/11/23 02:39:46 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/newvers.sh b/sys/arch/alpha/stand/boot/newvers.sh index a65d3cfb37d..605d7141d93 100644 --- a/sys/arch/alpha/stand/boot/newvers.sh +++ b/sys/arch/alpha/stand/boot/newvers.sh @@ -1,7 +1,7 @@ #!/bin/sh - # -# $OpenBSD: newvers.sh,v 1.4 1996/07/31 16:24:12 niklas Exp $ -# $NetBSD: newvers.sh,v 1.2 1995/11/23 02:39:48 cgd Exp $ +# $OpenBSD: newvers.sh,v 1.5 1996/10/30 22:40:44 niklas Exp $ +# $NetBSD: newvers.sh,v 1.3 1996/06/14 20:03:04 cgd Exp $ # # Copyright (c) 1984, 1986, 1990, 1993 # The Regents of the University of California. All rights reserved. @@ -37,9 +37,9 @@ # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 u=${USER-root} h=`hostname` t=`date` -r=`head -1 $1` +r=`head -1 $1 | awk ' { print $3 } '` -echo "char bootprog_name[] = \"OpenBSD/Alpha boot\";" > vers.c +echo "char bootprog_name[] = \"OpenBSD/Alpha Secondary Boot\";" > vers.c echo "char bootprog_rev[] = \"${r}\";" >> vers.c echo "char bootprog_date[] = \"${t}\";" >> vers.c echo "char bootprog_maker[] = \"${u}@${h}\";" >> vers.c diff --git a/sys/arch/alpha/stand/boot/prom_swpal.S b/sys/arch/alpha/stand/boot/prom_swpal.S index 718ad653260..6b0c010ffde 100644 --- a/sys/arch/alpha/stand/boot/prom_swpal.S +++ b/sys/arch/alpha/stand/boot/prom_swpal.S @@ -1,5 +1,5 @@ -/* $OpenBSD: prom_swpal.S,v 1.2 1996/07/29 23:01:44 niklas Exp $ */ -/* $NetBSD: prom_swpal.S,v 1.2 1995/02/16 02:32:58 cgd Exp $ */ +/* $OpenBSD: prom_swpal.S,v 1.3 1996/10/30 22:40:45 niklas Exp $ */ +/* $NetBSD: prom_swpal.S,v 1.4 1996/10/17 02:50:41 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -61,13 +61,13 @@ #define PALSW_FRAME_SIZE (14*8) #define PALSW_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5 - .comm ptbr_save 8 + .comm ptbr_save,8 .text .align 4 NESTED(switch_palcode, 0, PALSW_FRAME_SIZE, ra, PALSW_REGS, 0) - SETGP(pv) + LDGP(pv) /* ldgp gp, 0(pv)*/ lda sp, -PALSW_FRAME_SIZE(sp) @@ -105,8 +105,7 @@ NESTED(switch_palcode, 0, PALSW_FRAME_SIZE, ra, PALSW_REGS, 0) call_pal PAL_VMS_mfpr_vptb mov v0, a3 -/* movi PAL_OSF, a0 */ - CONST(PAL_OSF, a0) + ldiq a0, PAL_OSF lda a1, contin ldq a2, 16(sp) diff --git a/sys/arch/alpha/stand/boot/test.c b/sys/arch/alpha/stand/boot/test.c index 3da120e34b8..82fb6684ffe 100644 --- a/sys/arch/alpha/stand/boot/test.c +++ b/sys/arch/alpha/stand/boot/test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test.c,v 1.2 1996/07/29 23:01:46 niklas Exp $ */ +/* $OpenBSD: test.c,v 1.3 1996/10/30 22:40:46 niklas Exp $ */ /* $NetBSD: test.c,v 1.2 1995/02/16 02:33:00 cgd Exp $ */ /* diff --git a/sys/arch/alpha/stand/boot/version b/sys/arch/alpha/stand/boot/version index f396a5a7ebf..4343db37627 100644 --- a/sys/arch/alpha/stand/boot/version +++ b/sys/arch/alpha/stand/boot/version @@ -1,5 +1,5 @@ -$OpenBSD: version,v 1.4 1996/07/29 23:01:48 niklas Exp $ -$NetBSD: version,v 1.5 1996/05/09 23:54:18 cgd Exp $ +$OpenBSD: version,v 1.5 1996/10/30 22:40:47 niklas Exp $ +$NetBSD: version,v 1.6 1996/06/14 20:03:07 cgd Exp $ 1.1: Initial version 1.2: don't forget the Id string! @@ -7,3 +7,6 @@ $NetBSD: version,v 1.5 1996/05/09 23:54:18 cgd Exp $ 1.4-1: Re-import from master sources 1.4-2: Complete rewrite of boot block code 1.5: Update for new ECOFF headers +1.6: Don't pass arguments to the kernel, trim unnecessary environment + calls, kill 'ask' loop (i.e. if boot fails, halt), seperate + ECOFF and a.out support into seperate options. |